Skip to content

Commit ff118ea

Browse files
authored
fix(create-email): Node 18 support breaking due to dirname (#2253)
1 parent 812c551 commit ff118ea

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

.changeset/nine-parks-drop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-email": patch
3+
---
4+
5+
fix broken node 18 support

packages/create-email/src/index.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import logSymbols from 'log-symbols';
88
import ora from 'ora';
99
import { tree } from './tree.js';
1010

11+
const filename = fileURLToPath(import.meta.url);
12+
const dirname = path.dirname(filename);
13+
1114
const packageJson = JSON.parse(
12-
fse.readFileSync(
13-
path.resolve(import.meta.dirname, '../package.json'),
14-
'utf8',
15-
),
15+
fse.readFileSync(path.resolve(dirname, '../package.json'), 'utf8'),
1616
);
1717

1818
const getLatestVersionOfTag = async (packageName, tag) => {
@@ -46,8 +46,7 @@ const init = async (name, { tag }) => {
4646
projectPath = projectPath.trim();
4747
}
4848

49-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
50-
const templatePath = path.resolve(__dirname, '../template');
49+
const templatePath = path.resolve(dirname, '../template');
5150
const resolvedProjectPath = path.resolve(projectPath);
5251

5352
if (fse.existsSync(resolvedProjectPath)) {

0 commit comments

Comments
 (0)