diff --git a/.changeset/seven-pens-check.md b/.changeset/seven-pens-check.md new file mode 100644 index 0000000..67ee45d --- /dev/null +++ b/.changeset/seven-pens-check.md @@ -0,0 +1,5 @@ +--- +'create-esdx': patch +--- + +Fix error while creating a package diff --git a/packages/create-esdx/index.js b/packages/create-esdx/index.js index de260fb..c3d90c1 100755 --- a/packages/create-esdx/index.js +++ b/packages/create-esdx/index.js @@ -6,7 +6,6 @@ import fs from 'fs' import { blue, cyan, magenta, red, yellow } from 'kolorist' import minimist from 'minimist' import path from 'path' -import pkgDir from 'pkg-dir' import prompts from 'prompts' import url from 'url' @@ -52,19 +51,6 @@ const renameFiles = { _gitignore: '.gitignore', } -async function getPkg() { - const root = await pkgDir() - - const manifest = path.resolve(root, 'package.json') - - const pkg = JSON.parse( - fs.readFileSync(manifest, { - encoding: 'utf8', - }), - ) - return pkg -} - async function init() { let targetDir = argv._[0] let template = argv.template || argv.t @@ -184,7 +170,15 @@ async function init() { for (const file of files.filter((f) => f !== 'package.json')) { write(file, null) } - const pkg = await getPkg() + + const manifest = path.resolve(path.join(templateDir, `package.json`)) + + const pkg = JSON.parse( + fs.readFileSync(manifest, { + encoding: 'utf8', + }), + ) + delete pkg.private pkg.name = projectName diff --git a/packages/create-esdx/package.json b/packages/create-esdx/package.json index 3f1587e..acb6f11 100644 --- a/packages/create-esdx/package.json +++ b/packages/create-esdx/package.json @@ -11,7 +11,6 @@ "dependencies": { "kolorist": "^1.5.0", "minimist": "^1.2.5", - "pkg-dir": "^5.0.0", "prompts": "^2.4.1" }, "devDependencies": {