Skip to content

Commit 90ff5a7

Browse files
committed
enforce alphanumeric projects 🔫
1 parent 6b055b7 commit 90ff5a7

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

ignite-cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-ignite",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Create new react native files that fit the IR workflow",
55
"files": [
66
"index.js"

ignite-cli/src/index.es

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ const checkYo = () => {
1616
}
1717
}
1818

19+
const checkName = (project) => {
20+
// Only alphanumeric project names
21+
if (/[^a-z0-9]+/i.test(project)) {
22+
console.log(`"${project}" is not a valid name for a project. Please use a valid identifier name (alphanumeric).`)
23+
Shell.exit(1)
24+
}
25+
}
26+
1927
// version
2028
Program
2129
.version(pjson.version)
@@ -27,6 +35,7 @@ Program
2735
.alias('n')
2836
.action((project) => {
2937
checkYo()
38+
checkName(project)
3039
console.log(`🔥 Setting ${project} on ${FIRE} 🔥`)
3140
spawn('yo', ['react-native-ignite', project], { shell: true, stdio: 'inherit' })
3241
})

0 commit comments

Comments
 (0)