create-fullstack-setup 1.0.10 → 1.0.11
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/bin/index.js +54 -18
- package/package.json +1 -1
- package/utils/features.config.js +1 -0
- package/utils/prompts.js +0 -59
package/bin/index.js
CHANGED
|
@@ -14,59 +14,89 @@ const answers = await inquirer.prompt([
|
|
|
14
14
|
validate: (input) => (input ? true : "Project name is required")
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
type: "
|
|
17
|
+
type: "list",
|
|
18
18
|
name: "frontend",
|
|
19
19
|
message: "Choose frontend:",
|
|
20
20
|
choices: ["React", "Next.js", "None"]
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
type: "
|
|
23
|
+
type: "list",
|
|
24
24
|
name: "backend",
|
|
25
25
|
message: "Choose backend:",
|
|
26
26
|
choices: ["Express"]
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
type: "
|
|
29
|
+
type: "list",
|
|
30
30
|
name: "language",
|
|
31
31
|
message: "Choose language:",
|
|
32
32
|
choices: ["JavaScript", "TypeScript"]
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
type: "confirm",
|
|
36
|
+
name: "useBackendFeatures",
|
|
37
|
+
message: "Select backend features?",
|
|
38
|
+
default: true
|
|
39
|
+
},
|
|
40
|
+
|
|
40
41
|
{
|
|
41
42
|
type: "confirm",
|
|
42
|
-
name: "
|
|
43
|
+
name: "JWT",
|
|
43
44
|
message: "Use JWT authentication?",
|
|
44
45
|
default: true,
|
|
45
46
|
when: (ans) => ans.useBackendFeatures
|
|
46
47
|
},
|
|
47
48
|
{
|
|
48
49
|
type: "confirm",
|
|
49
|
-
name: "
|
|
50
|
+
name: "CORS",
|
|
50
51
|
message: "Enable CORS?",
|
|
51
52
|
default: true,
|
|
52
53
|
when: (ans) => ans.useBackendFeatures
|
|
53
54
|
},
|
|
54
55
|
{
|
|
55
56
|
type: "confirm",
|
|
56
|
-
name: "
|
|
57
|
+
name: "CookieParser",
|
|
57
58
|
message: "Use Cookie Parser?",
|
|
58
59
|
default: true,
|
|
59
60
|
when: (ans) => ans.useBackendFeatures
|
|
60
61
|
},
|
|
61
62
|
{
|
|
62
63
|
type: "confirm",
|
|
63
|
-
name: "
|
|
64
|
-
message: "Use
|
|
64
|
+
name: "dotenv",
|
|
65
|
+
message: "Use environment variable ?",
|
|
66
|
+
default: true,
|
|
67
|
+
when: (ans) => ans.useBackendFeatures
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
type: "confirm",
|
|
71
|
+
name: "Zod",
|
|
72
|
+
message: "Use Zod validator?",
|
|
73
|
+
default: true,
|
|
74
|
+
when: (ans) => ans.useBackendFeatures
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: "confirm",
|
|
78
|
+
name: "multer",
|
|
79
|
+
message: "Use multer ?",
|
|
80
|
+
default: true,
|
|
81
|
+
when: (ans) => ans.useBackendFeatures
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: "confirm",
|
|
85
|
+
name: "Mongoose",
|
|
86
|
+
message: "Use MongoDB (Mongoose)?",
|
|
87
|
+
default: true,
|
|
88
|
+
when: (ans) => ans.useBackendFeatures
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: "confirm",
|
|
92
|
+
name: "Bcrypt",
|
|
93
|
+
message: "Use Bcrypt for password hashing?",
|
|
65
94
|
default: true,
|
|
66
95
|
when: (ans) => ans.useBackendFeatures
|
|
67
96
|
}
|
|
68
97
|
]);
|
|
69
98
|
|
|
99
|
+
|
|
70
100
|
const frontendMap = {
|
|
71
101
|
React: {
|
|
72
102
|
JavaScript: "react-js",
|
|
@@ -87,13 +117,19 @@ const backendMap = {
|
|
|
87
117
|
};
|
|
88
118
|
|
|
89
119
|
const backendFeatures = [];
|
|
120
|
+
|
|
90
121
|
if (answers.useBackendFeatures) {
|
|
91
|
-
if (answers.
|
|
92
|
-
if (answers.
|
|
93
|
-
if (answers.
|
|
94
|
-
if (answers.
|
|
122
|
+
if (answers.JWT) backendFeatures.push("JWT");
|
|
123
|
+
if (answers.CORS) backendFeatures.push("CORS");
|
|
124
|
+
if (answers.CookieParser) backendFeatures.push("Cookie-Parser");
|
|
125
|
+
if (answers.dotenv) backendFeatures.push("Dotenv");
|
|
126
|
+
if (answers.Zod) backendFeatures.push("Zod");
|
|
127
|
+
if (answers.multer) backendFeatures.push("Multer");
|
|
128
|
+
if (answers.Mongoose) backendFeatures.push("Mongoose");
|
|
129
|
+
if (answers.Bcrypt) backendFeatures.push("Bcrypt");
|
|
95
130
|
}
|
|
96
131
|
|
|
132
|
+
|
|
97
133
|
const config = {
|
|
98
134
|
projectName: answers.projectName,
|
|
99
135
|
frontend:
|
|
@@ -104,4 +140,4 @@ const config = {
|
|
|
104
140
|
backendFeatures
|
|
105
141
|
};
|
|
106
142
|
|
|
107
|
-
await createProject(config);
|
|
143
|
+
await createProject(config);
|
package/package.json
CHANGED
package/utils/features.config.js
CHANGED
package/utils/prompts.js
CHANGED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { type } from "os";
|
|
2
|
-
|
|
3
|
-
const answers = await inquirer.prompt([
|
|
4
|
-
{
|
|
5
|
-
type:"confirm",
|
|
6
|
-
name:"express",
|
|
7
|
-
message:"install express ?",
|
|
8
|
-
default:true
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
{
|
|
12
|
-
type: "confirm",
|
|
13
|
-
name: "JWT",
|
|
14
|
-
message: "Use JWT authentication?",
|
|
15
|
-
default: true
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
type: "confirm",
|
|
19
|
-
name: "CORS",
|
|
20
|
-
message: "Enable CORS?",
|
|
21
|
-
default: true
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
type: "confirm",
|
|
25
|
-
name: "CookieParser",
|
|
26
|
-
message: "Use Cookie Parser?",
|
|
27
|
-
default: true
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: "confirm",
|
|
31
|
-
name: "dotenv",
|
|
32
|
-
message: "Use environment variable ?",
|
|
33
|
-
default: true
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
type: "confirm",
|
|
37
|
-
name: "Zod",
|
|
38
|
-
message: "Use Zod validator?",
|
|
39
|
-
default: true
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
type: "confirm",
|
|
43
|
-
name: "multer",
|
|
44
|
-
message: "Use multer ?",
|
|
45
|
-
default: true
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
type: "confirm",
|
|
49
|
-
name: "Mongoose",
|
|
50
|
-
message: "Use MongoDB (Mongoose)?",
|
|
51
|
-
default: false
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
type: "confirm",
|
|
55
|
-
name: "Bcrypt",
|
|
56
|
-
message: "Use Bcrypt for password hashing?",
|
|
57
|
-
default: true
|
|
58
|
-
}
|
|
59
|
-
]);
|