mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-26 07:04:05 +08:00
Only allow valid identifier names as project names. Fixes #213
This commit is contained in:
9
react-native-cli/index.js
vendored
9
react-native-cli/index.js
vendored
@@ -53,6 +53,15 @@ if (cli) {
|
||||
}
|
||||
|
||||
function init(name) {
|
||||
if (!name.match(/^[$A-Z_][0-9A-Z_$]*$/i)) {
|
||||
console.error(
|
||||
'"%s" is not a valid name for a project. Please use a valid identifier ' +
|
||||
'name (alphanumeric).',
|
||||
name
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
var root = path.resolve(name);
|
||||
var projectName = path.basename(root);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user