mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 03:26:07 +00:00
Only allow valid identifier names as project names. Fixes #213
This commit is contained in:
parent
90f399c4d1
commit
5ce9ab143a
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user