Skip to content

Commit

Permalink
fix: error while creating a package
Browse files Browse the repository at this point in the history
  • Loading branch information
merodiro committed Jun 22, 2021
1 parent 3954c1c commit d1c448c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/seven-pens-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-esdx': patch
---

Fix error while creating a package
24 changes: 9 additions & 15 deletions packages/create-esdx/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion packages/create-esdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"dependencies": {
"kolorist": "^1.5.0",
"minimist": "^1.2.5",
"pkg-dir": "^5.0.0",
"prompts": "^2.4.1"
},
"devDependencies": {
Expand Down

0 comments on commit d1c448c

Please sign in to comment.