We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f7d85ae commit 1dbf246Copy full SHA for 1dbf246
packages/create-app/index.js
@@ -118,7 +118,15 @@ async function init() {
118
}
119
120
const pkg = require(path.join(templateDir, `package.json`))
121
- pkg.name = path.basename(root)
+
122
+ pkg.name = path
123
+ .basename(root)
124
+ // #2360 ensure packgae.json name is valid
125
+ .trim()
126
+ .replace(/\s+/g, '-')
127
+ .replace(/^[._]/, '')
128
+ .replace(/[~)('!*]+/g, '-')
129
130
write('package.json', JSON.stringify(pkg, null, 2))
131
132
const pkgManager = /yarn/.test(process.env.npm_execpath) ? 'yarn' : 'npm'
0 commit comments