Skip to content

Commit 1a8e8ee

Browse files
committed
fix(template): get plugin path from module import meta
1 parent a682a83 commit 1a8e8ee

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
import { join } from 'path'
2+
import { join, dirname } from 'path'
33
import { existsSync, unlinkSync, rmdirSync, lstatSync, mkdirSync } from 'fs'
44
import { copySync } from 'fs-extra'
55
import { execSync } from 'child_process'
@@ -32,11 +32,9 @@ if (existsSync(name.regular)) {
3232

3333
mkdirSync(name.regular)
3434

35-
console.log(process.env.PWD, 'debug', process.env.INIT_CWD)
35+
const npmPackagePath = dirname(import.meta.url)
3636

37-
process.exit()
38-
39-
const templateDirectory = join(__dirname, 'template')
37+
const templateDirectory = join(npmPackagePath, 'template')
4038
const destinationDirectory = join(process.cwd(), name.regular)
4139

4240
copySync(templateDirectory, destinationDirectory)

0 commit comments

Comments
 (0)