Only allow valid identifier names as project names. Fixes #213

This commit is contained in:
Amjad Masad 2015-03-26 11:19:18 -07:00
parent 90f399c4d1
commit 5ce9ab143a

View File

@ -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);