Skip to content

Commit 33f3f8e

Browse files
committed
add app id prompt and validator
1 parent ed0c969 commit 33f3f8e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Diff for: prompts.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = [
2+
{
3+
name: 'applicationId',
4+
type: 'input',
5+
message: 'Enter a unique application identifier:',
6+
default: 'org.nativescript.application',
7+
validate(applicationId) {
8+
const idRE = /^([A-Za-z][A-Za-z\d_]*\.)+[A-Za-z][A-Za-z\d_]*$/
9+
10+
if (!idRE.test(applicationId)) {
11+
return `Invalid application identifier.
12+
A valid identifier:
13+
- must contain two or more strings separated by a dot
14+
- each string must start with a letter
15+
- each string can only contain numbers, letters and the _ character
16+
Example: com.company.app`
17+
}
18+
19+
return true;
20+
}
21+
}
22+
]

0 commit comments

Comments
 (0)