create-dummy-express 0.0.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.
Files changed (2) hide show
  1. package/index.js +55 -0
  2. package/package.json +13 -0
package/index.js ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+
3
+ const prompts = require("prompts");
4
+
5
+ let interval;
6
+
7
+ const questions = [
8
+ {
9
+ type: "text",
10
+ name: "name",
11
+ message: "What is your name?",
12
+ },
13
+ {
14
+ type: "number",
15
+ name: "age",
16
+ message: "How old are you?",
17
+ validate: (value) =>
18
+ value < 18 ? "You must be at least 18 years old" : true,
19
+ },
20
+ {
21
+ type: "select",
22
+ name: "color",
23
+ message: "Pick a color",
24
+ choices: [
25
+ { title: "Red", value: "red" },
26
+ { title: "Green", value: "green" },
27
+ { title: "Blue", value: "blue" },
28
+ ],
29
+ },
30
+ {
31
+ type: "multiselect",
32
+ name: "hobbies",
33
+ message: "Select your hobbies",
34
+ choices: [
35
+ { title: "Reading", value: "reading" },
36
+ { title: "Traveling", value: "traveling" },
37
+ { title: "Cooking", value: "cooking" },
38
+ { title: "Sports", value: "sports" },
39
+ ],
40
+ },
41
+ ];
42
+
43
+ //
44
+ (async () => {
45
+ const aswers = await prompts(questions, {
46
+ onCancel: cleanup,
47
+ onSubmit: cleanup,
48
+ });
49
+
50
+ console.log({ aswers });
51
+ })();
52
+
53
+ function cleanup() {
54
+ clearInterval(interval);
55
+ }
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "create-dummy-express",
3
+ "version": "0.0.1",
4
+ "bin": {
5
+ "create-dummy-express": "index.js"
6
+ },
7
+ "dependencies": {
8
+ "prompts": "^2.4.2"
9
+ },
10
+ "devDependencies": {
11
+ "@types/prompts": "^2.4.9"
12
+ }
13
+ }