Skip to content

Commit 7e1072a

Browse files
committed
🐛 BUG fix __dirname not defined resolved
1 parent 313b395 commit 7e1072a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/create-ts-api/src/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import fs from 'fs-extra';
66
import path from 'path';
77
import inquirer from 'inquirer';
88
import simpleGit from 'simple-git';
9+
import { fileURLToPath } from 'url';
910

11+
const filename = fileURLToPath(import.meta.url);
12+
const dirname = path.dirname(filename);
13+
console.log(dirname);
1014
inquirer
1115
.prompt([
1216
{
@@ -119,7 +123,7 @@ async function createApp(
119123

120124
fs.mkdirsSync(projectDestination);
121125

122-
fs.copySync(path.join(__dirname, '..', template), projectName);
126+
fs.copySync(path.join(dirname, '..', template), projectName);
123127

124128
const packageJson = JSON.parse(
125129
fs.readFileSync(path.join(projectName, 'package.json'))

0 commit comments

Comments
 (0)