Skip to content

Commit

Permalink
really fix prepack script
Browse files Browse the repository at this point in the history
  • Loading branch information
talentlessguy committed Jun 27, 2024
1 parent f2915bc commit 8043c85
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/ensjs/scripts/prepack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ function generatePackageJson() {
if (key === '.') continue
if (!value.default || !value.import)
throw new Error('`default` and `import` are required.')
fs.writeFileSync(
`${key}/package.json`,
`{
if (!fs.existsSync(key)) fs.mkdirSync(key)
if (!fs.existsSync(`${key}/package.json`))
fs.writeFileSync(
`${key}/package.json`,
`{
${Object.entries(value)
.map(([k, v]) => {
const key_ = (() => {
Expand All @@ -64,8 +66,7 @@ function generatePackageJson() {
})
.join(',\n ')}
}`,
{ flag: 'wx' },
)
)
files_.push(key.replace('./', ''))
}

Expand Down

0 comments on commit 8043c85

Please sign in to comment.