@shipcli/create 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +8 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -11,12 +11,20 @@ var TEMPLATES_DIR = join(__dirname, "..", "templates");
|
|
|
11
11
|
var args = process.argv.slice(2);
|
|
12
12
|
var name = args[0];
|
|
13
13
|
|
|
14
|
+
var VALID_NAME = /^[a-zA-Z][a-zA-Z0-9_-]*$/;
|
|
15
|
+
|
|
14
16
|
if (!name) {
|
|
15
17
|
console.error(kleur.red("Usage: create-shipcli <name>"));
|
|
16
18
|
console.error(kleur.dim(" Example: npx create-shipcli codeautopsy"));
|
|
17
19
|
process.exit(1);
|
|
18
20
|
}
|
|
19
21
|
|
|
22
|
+
if (!VALID_NAME.test(name)) {
|
|
23
|
+
console.error(kleur.red(`Invalid name: ${name}`));
|
|
24
|
+
console.error(kleur.dim(" Use letters, numbers, hyphens, and underscores only."));
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
20
28
|
var description = args[1] || `A CLI tool built with shipcli`;
|
|
21
29
|
var share = true;
|
|
22
30
|
|