psf-cli 0.2.2 → 0.3.0
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 +20 -20
- package/src/cli.js +27 -1
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "psf-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"main": "cli.js",
|
|
5
|
-
"bin": {
|
|
6
|
-
"psf": "src/cli.js"
|
|
7
|
-
},
|
|
8
|
-
"type": "module",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
-
},
|
|
12
|
-
"keywords": [],
|
|
13
|
-
"author": "",
|
|
14
|
-
"license": "ISC",
|
|
15
|
-
"description": "",
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"chalk": "^5.6.2",
|
|
18
|
-
"commander": "^14.0.2"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "psf-cli",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"main": "cli.js",
|
|
5
|
+
"bin": {
|
|
6
|
+
"psf": "src/cli.js"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"description": "",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"chalk": "^5.6.2",
|
|
18
|
+
"commander": "^14.0.2"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/cli.js
CHANGED
|
@@ -28,6 +28,30 @@ program
|
|
|
28
28
|
program.option("-t, --template <string>", "template type", "node");
|
|
29
29
|
program.option("-d, --dir <path>", "Output directory", process.cwd());
|
|
30
30
|
|
|
31
|
+
program
|
|
32
|
+
.command("info <template>")
|
|
33
|
+
.description("Show templates details")
|
|
34
|
+
.action(async (template) => {
|
|
35
|
+
try {
|
|
36
|
+
switch (template) {
|
|
37
|
+
case "node":
|
|
38
|
+
console.log(
|
|
39
|
+
`Template: ${template}\nStructure:\n- src/index.js\n- .gitignore\n- package.json\n- README.md`,
|
|
40
|
+
);
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
throw new Error(
|
|
44
|
+
chalk.red(
|
|
45
|
+
`Invalid template: "${template}". Available templates: node`,
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
} catch (err) {
|
|
50
|
+
console.log(err);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// List command
|
|
31
55
|
program
|
|
32
56
|
.command("list")
|
|
33
57
|
.description("Templates list")
|
|
@@ -50,7 +74,9 @@ program
|
|
|
50
74
|
break;
|
|
51
75
|
default:
|
|
52
76
|
throw new Error(
|
|
53
|
-
|
|
77
|
+
chalk.red(
|
|
78
|
+
`Invalid template: "${opts.template}". Available templates: node`,
|
|
79
|
+
),
|
|
54
80
|
);
|
|
55
81
|
}
|
|
56
82
|
} catch (err) {
|