Skip to content

Commit 5fa2b17

Browse files
fix(jsx-email): change how package.json is read so it doesn't break with recent node versions (#215)
1 parent fbf0d2c commit 5fa2b17

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

packages/jsx-email/src/cli/commands/help.mts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import chalk from 'chalk';
22

3-
// @ts-ignore
4-
import pkg from '../../../package.json' assert { type: 'json' };
3+
import { name, version } from '../../package-info.cjs';
54

65
import type { CommandFn } from './types.mjs';
76
import { help as build } from './build.mjs';
@@ -12,7 +11,7 @@ import { help as preview } from './preview.mjs';
1211
const { log } = console;
1312

1413
export const helpMessage = chalk`
15-
{blue ${pkg.name}} v${pkg.version}
14+
{blue ${name}} v${version}
1615
1716
The jsx-email CLI. Build, Check, Create and View email templates
1817

packages/jsx-email/src/cli/main.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sourceMapSupport from 'source-map-support';
22
import yargs from 'yargs-parser';
33

4-
import pkg from '../../package.json' assert { type: 'json' };
4+
import { name, version } from '../package-info.cjs';
55

66
import { debug } from '../debug.js';
77

@@ -29,7 +29,7 @@ const run = async () => {
2929
debug.cli(`Command Name: \`${commandName}\``);
3030

3131
if (flags.version) {
32-
log(`${pkg.name} v${pkg.version}\n`);
32+
log(`${name} v${version}\n`);
3333
return;
3434
}
3535

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// eslint-disable-next-line
2+
const pkg = require('../package.json') as { name: string; version: string };
3+
4+
export const { name, version } = pkg;

0 commit comments

Comments
 (0)