Skip to content

Commit

Permalink
Only allow valid identifier names as project names. Fixes facebook#213
Browse files Browse the repository at this point in the history
  • Loading branch information
amasad committed Mar 26, 2015
1 parent 90f399c commit 5ce9ab1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions react-native-cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 5ce9ab1

Please sign in to comment.