@tsed/cli 3.25.0 → 4.0.0-rc.2
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/lib/cjs/Cli.js.map +1 -1
- package/lib/cjs/commands/init/InitCmd.js +70 -35
- package/lib/cjs/commands/init/InitCmd.js.map +1 -1
- package/lib/cjs/commands/init/config/FeaturesPrompt.js +406 -0
- package/lib/cjs/commands/init/config/FeaturesPrompt.js.map +1 -0
- package/lib/cjs/commands/init/config/InitFileSchema.js +53 -0
- package/lib/cjs/commands/init/config/InitFileSchema.js.map +1 -0
- package/lib/cjs/commands/init/interfaces/InitCmdContext.js +3 -0
- package/lib/cjs/commands/init/interfaces/InitCmdContext.js.map +1 -0
- package/lib/cjs/commands/init/interfaces/InitOptions.js +3 -0
- package/lib/cjs/commands/init/interfaces/InitOptions.js.map +1 -0
- package/lib/cjs/commands/init/interfaces/InitPromptAnswers.js +3 -0
- package/lib/cjs/commands/init/interfaces/InitPromptAnswers.js.map +1 -0
- package/lib/cjs/commands/init/mappers/mapToContext.js +16 -0
- package/lib/cjs/commands/init/mappers/mapToContext.js.map +1 -0
- package/lib/cjs/commands/init/mappers/mapUniqFeatures.js +18 -0
- package/lib/cjs/commands/init/mappers/mapUniqFeatures.js.map +1 -0
- package/lib/cjs/commands/init/prompts/getFeaturesPrompt.js +25 -0
- package/lib/cjs/commands/init/prompts/getFeaturesPrompt.js.map +1 -0
- package/lib/cjs/commands/init/utils/hasFeature.js +13 -0
- package/lib/cjs/commands/init/utils/hasFeature.js.map +1 -0
- package/lib/cjs/commands/init/utils/isPlatform.js +8 -0
- package/lib/cjs/commands/init/utils/isPlatform.js.map +1 -0
- package/lib/cjs/constants/index.js +3 -3
- package/lib/cjs/constants/index.js.map +1 -1
- package/lib/cjs/index.js +5 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/PlatformType.js +9 -0
- package/lib/cjs/interfaces/PlatformType.js.map +1 -0
- package/lib/cjs/interfaces/index.js +1 -0
- package/lib/cjs/interfaces/index.js.map +1 -1
- package/lib/esm/Cli.js.map +1 -1
- package/lib/esm/commands/init/InitCmd.js +73 -38
- package/lib/esm/commands/init/InitCmd.js.map +1 -1
- package/lib/esm/commands/init/config/FeaturesPrompt.js +402 -0
- package/lib/esm/commands/init/config/FeaturesPrompt.js.map +1 -0
- package/lib/esm/commands/init/config/InitFileSchema.js +50 -0
- package/lib/esm/commands/init/config/InitFileSchema.js.map +1 -0
- package/lib/esm/commands/init/interfaces/InitCmdContext.js +2 -0
- package/lib/esm/commands/init/interfaces/InitCmdContext.js.map +1 -0
- package/lib/esm/commands/init/interfaces/InitOptions.js +2 -0
- package/lib/esm/commands/init/interfaces/InitOptions.js.map +1 -0
- package/lib/esm/commands/init/interfaces/InitPromptAnswers.js +2 -0
- package/lib/esm/commands/init/interfaces/InitPromptAnswers.js.map +1 -0
- package/lib/esm/commands/init/mappers/mapToContext.js +12 -0
- package/lib/esm/commands/init/mappers/mapToContext.js.map +1 -0
- package/lib/esm/commands/init/mappers/mapUniqFeatures.js +14 -0
- package/lib/esm/commands/init/mappers/mapUniqFeatures.js.map +1 -0
- package/lib/esm/commands/init/prompts/getFeaturesPrompt.js +21 -0
- package/lib/esm/commands/init/prompts/getFeaturesPrompt.js.map +1 -0
- package/lib/esm/commands/init/utils/hasFeature.js +8 -0
- package/lib/esm/commands/init/utils/hasFeature.js.map +1 -0
- package/lib/esm/commands/init/utils/isPlatform.js +4 -0
- package/lib/esm/commands/init/utils/isPlatform.js.map +1 -0
- package/lib/esm/constants/index.js +3 -3
- package/lib/esm/constants/index.js.map +1 -1
- package/lib/esm/index.js +5 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/PlatformType.js +6 -0
- package/lib/esm/interfaces/PlatformType.js.map +1 -0
- package/lib/esm/interfaces/index.js +1 -0
- package/lib/esm/interfaces/index.js.map +1 -1
- package/lib/types/Cli.d.ts +2 -2
- package/lib/types/commands/init/InitCmd.d.ts +8 -24
- package/lib/types/commands/init/config/FeaturesPrompt.d.ts +98 -0
- package/lib/types/commands/init/config/InitFileSchema.d.ts +49 -0
- package/lib/types/commands/init/interfaces/InitCmdContext.d.ts +6 -0
- package/lib/types/commands/init/interfaces/InitOptions.d.ts +19 -0
- package/lib/types/commands/init/interfaces/InitPromptAnswers.d.ts +16 -0
- package/lib/types/commands/init/mappers/mapToContext.d.ts +2 -0
- package/lib/types/commands/init/mappers/mapUniqFeatures.d.ts +3 -0
- package/lib/types/commands/init/prompts/getFeaturesPrompt.d.ts +2 -0
- package/lib/types/commands/init/utils/hasFeature.d.ts +2 -0
- package/lib/types/commands/init/utils/isPlatform.d.ts +1 -0
- package/lib/types/constants/index.d.ts +2 -2
- package/lib/types/index.d.ts +5 -1
- package/lib/types/interfaces/PlatformType.d.ts +4 -0
- package/lib/types/interfaces/index.d.ts +1 -0
- package/package.json +14 -9
- package/readme.md +104 -14
- package/templates/init/tsconfig.json.hbs +5 -3
- package/lib/cjs/services/Features.js +0 -528
- package/lib/cjs/services/Features.js.map +0 -1
- package/lib/esm/services/Features.js +0 -519
- package/lib/esm/services/Features.js.map +0 -1
- package/lib/types/services/Features.d.ts +0 -412
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { PackageManager } from "@tsed/cli-core";
|
|
2
|
+
import { isPlatform } from "../utils/isPlatform.js";
|
|
3
|
+
import { hasFeature, hasValue } from "../utils/hasFeature.js";
|
|
4
|
+
import { ArchitectureConvention, PlatformType, ProjectConvention } from "../../../interfaces.js";
|
|
5
|
+
export var FeatureType;
|
|
6
|
+
(function (FeatureType) {
|
|
7
|
+
FeatureType["GRAPHQL"] = "graphql";
|
|
8
|
+
FeatureType["SOCKETIO"] = "socketio";
|
|
9
|
+
FeatureType["SWAGGER"] = "swagger";
|
|
10
|
+
FeatureType["OIDC"] = "oidc";
|
|
11
|
+
FeatureType["PASSPORTJS"] = "passportjs";
|
|
12
|
+
FeatureType["COMMANDS"] = "commands";
|
|
13
|
+
FeatureType["DB"] = "db";
|
|
14
|
+
// ORM
|
|
15
|
+
FeatureType["PRISMA"] = "prisma";
|
|
16
|
+
FeatureType["MONGOOSE"] = "mongoose";
|
|
17
|
+
// TYPEORM
|
|
18
|
+
FeatureType["TYPEORM"] = "typeorm";
|
|
19
|
+
FeatureType["TYPEORM_MYSQL"] = "typeorm:mysql";
|
|
20
|
+
FeatureType["TYPEORM_MARIADB"] = "typeorm:mariadb";
|
|
21
|
+
FeatureType["TYPEORM_POSTGRES"] = "typeorm:postgres";
|
|
22
|
+
FeatureType["TYPEORM_COCKROACHDB"] = "typeorm:cockroachdb";
|
|
23
|
+
FeatureType["TYPEORM_SQLITE"] = "typeorm:sqlite";
|
|
24
|
+
FeatureType["TYPEORM_BETTER_SQLITE3"] = "typeorm:better-sqlite3";
|
|
25
|
+
FeatureType["TYPEORM_CORDOVA"] = "typeorm:cordova";
|
|
26
|
+
FeatureType["TYPEORM_NATIVESCRIPT"] = "typeorm:nativescript";
|
|
27
|
+
FeatureType["TYPEORM_ORACLE"] = "typeorm:oracle";
|
|
28
|
+
FeatureType["TYPEORM_MSSQL"] = "typeorm:mssql";
|
|
29
|
+
FeatureType["TYPEORM_MONGODB"] = "typeorm:mongodb";
|
|
30
|
+
FeatureType["TYPEORM_SQLJS"] = "typeorm:sqljs";
|
|
31
|
+
FeatureType["TYPEORM_REACTNATIVE"] = "typeorm:reactnative";
|
|
32
|
+
FeatureType["TYPEORM_EXPO"] = "typeorm:expo";
|
|
33
|
+
// TESTING
|
|
34
|
+
FeatureType["TESTING"] = "testing";
|
|
35
|
+
FeatureType["JEST"] = "jest";
|
|
36
|
+
FeatureType["MOCHA"] = "mocha";
|
|
37
|
+
FeatureType["LINTER"] = "linter";
|
|
38
|
+
FeatureType["ESLINT"] = "eslint";
|
|
39
|
+
FeatureType["LINT_STAGED"] = "lintstaged";
|
|
40
|
+
FeatureType["PRETTIER"] = "prettier";
|
|
41
|
+
// BUNDLER
|
|
42
|
+
FeatureType["BUNDLER"] = "bundler";
|
|
43
|
+
FeatureType["BABEL"] = "babel";
|
|
44
|
+
FeatureType["WEBPACK"] = "babel:webpack";
|
|
45
|
+
})(FeatureType || (FeatureType = {}));
|
|
46
|
+
export const FeaturesMap = {
|
|
47
|
+
[PlatformType.EXPRESS]: {
|
|
48
|
+
name: "Express.js",
|
|
49
|
+
checked: (options) => options.platform !== PlatformType.KOA
|
|
50
|
+
},
|
|
51
|
+
[PlatformType.KOA]: {
|
|
52
|
+
name: "Koa.js",
|
|
53
|
+
checked: (options) => options.platform === PlatformType.KOA
|
|
54
|
+
},
|
|
55
|
+
[FeatureType.GRAPHQL]: {
|
|
56
|
+
name: "TypeGraphQL",
|
|
57
|
+
dependencies: {
|
|
58
|
+
"@tsed/typegraphql": "{{tsedVersion}}"
|
|
59
|
+
},
|
|
60
|
+
devDependencies: {
|
|
61
|
+
"@tsed/cli-plugin-typegraphql": "{{cliVersion}}"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
[FeatureType.DB]: {
|
|
65
|
+
name: "Database"
|
|
66
|
+
},
|
|
67
|
+
[FeatureType.PASSPORTJS]: {
|
|
68
|
+
name: "Passport.js",
|
|
69
|
+
when: isPlatform(PlatformType.EXPRESS),
|
|
70
|
+
devDependencies: {
|
|
71
|
+
"@tsed/cli-plugin-passport": "{{cliVersion}}"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
[FeatureType.SOCKETIO]: {
|
|
75
|
+
name: "Socket.io",
|
|
76
|
+
dependencies: {
|
|
77
|
+
"@tsed/socketio": "{{tsedVersion}}",
|
|
78
|
+
"socket.io": "latest"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
[FeatureType.SWAGGER]: {
|
|
82
|
+
name: "Swagger",
|
|
83
|
+
dependencies: {
|
|
84
|
+
"@tsed/swagger": "{{tsedVersion}}"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
[FeatureType.OIDC]: {
|
|
88
|
+
name: "OpenID Connect provider",
|
|
89
|
+
devDependencies: {
|
|
90
|
+
"@tsed/cli-plugin-oidc-provider": "{{cliVersion}}"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
[FeatureType.TESTING]: {
|
|
94
|
+
name: "Testing",
|
|
95
|
+
dependencies: {},
|
|
96
|
+
devDependencies: {
|
|
97
|
+
"@types/supertest": "latest",
|
|
98
|
+
supertest: "latest"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
[FeatureType.LINTER]: {
|
|
102
|
+
name: "Linter"
|
|
103
|
+
},
|
|
104
|
+
[FeatureType.BUNDLER]: {
|
|
105
|
+
name: "Bundler"
|
|
106
|
+
},
|
|
107
|
+
[FeatureType.COMMANDS]: {
|
|
108
|
+
name: "Commands",
|
|
109
|
+
dependencies: {
|
|
110
|
+
"@tsed/cli-core": "{{cliVersion}}"
|
|
111
|
+
},
|
|
112
|
+
devDependencies: {
|
|
113
|
+
"@types/inquirer": "latest"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
[ProjectConvention.DEFAULT]: {
|
|
117
|
+
name: "Ts.ED",
|
|
118
|
+
checked: true
|
|
119
|
+
},
|
|
120
|
+
[ProjectConvention.ANGULAR]: {
|
|
121
|
+
name: "Angular",
|
|
122
|
+
checked: false
|
|
123
|
+
},
|
|
124
|
+
[ArchitectureConvention.DEFAULT]: {
|
|
125
|
+
name: "Ts.ED",
|
|
126
|
+
checked: true
|
|
127
|
+
},
|
|
128
|
+
[ArchitectureConvention.FEATURE]: {
|
|
129
|
+
name: "feature",
|
|
130
|
+
checked: false
|
|
131
|
+
},
|
|
132
|
+
[FeatureType.TYPEORM_MYSQL]: {
|
|
133
|
+
name: "MySQL",
|
|
134
|
+
dependencies: {
|
|
135
|
+
mysql2: "latest"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
[FeatureType.TYPEORM_MARIADB]: {
|
|
139
|
+
name: "MariaDB",
|
|
140
|
+
dependencies: {
|
|
141
|
+
mariadb: "latest"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
[FeatureType.TYPEORM_POSTGRES]: {
|
|
145
|
+
name: "Postgres",
|
|
146
|
+
dependencies: {
|
|
147
|
+
pg: "latest"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
[FeatureType.TYPEORM_COCKROACHDB]: {
|
|
151
|
+
name: "CockRoachDB",
|
|
152
|
+
dependencies: {
|
|
153
|
+
cockroachdb: "latest"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
[FeatureType.TYPEORM_SQLITE]: {
|
|
157
|
+
name: "SQLite",
|
|
158
|
+
dependencies: {
|
|
159
|
+
sqlite3: "latest"
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
[FeatureType.TYPEORM_BETTER_SQLITE3]: {
|
|
163
|
+
name: "Better SQLite3",
|
|
164
|
+
dependencies: {
|
|
165
|
+
"better-sqlite3": "latest"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
[FeatureType.TYPEORM_CORDOVA]: {
|
|
169
|
+
name: "Cordova"
|
|
170
|
+
},
|
|
171
|
+
[FeatureType.TYPEORM_NATIVESCRIPT]: {
|
|
172
|
+
name: "NativeScript"
|
|
173
|
+
},
|
|
174
|
+
[FeatureType.TYPEORM_ORACLE]: {
|
|
175
|
+
name: "Oracle",
|
|
176
|
+
dependencies: {
|
|
177
|
+
oracledb: "latest"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
[FeatureType.TYPEORM_MSSQL]: {
|
|
181
|
+
name: "MsSQL",
|
|
182
|
+
dependencies: {
|
|
183
|
+
mssql: "latest"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
[FeatureType.TYPEORM_MONGODB]: {
|
|
187
|
+
name: "MongoDB",
|
|
188
|
+
dependencies: {
|
|
189
|
+
mongodb: "latest"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
[FeatureType.TYPEORM_SQLJS]: {
|
|
193
|
+
name: "SQL.js"
|
|
194
|
+
},
|
|
195
|
+
[FeatureType.TYPEORM_REACTNATIVE]: {
|
|
196
|
+
name: "ReactNative"
|
|
197
|
+
},
|
|
198
|
+
[FeatureType.TYPEORM_EXPO]: {
|
|
199
|
+
name: "Expo"
|
|
200
|
+
},
|
|
201
|
+
[FeatureType.PRISMA]: {
|
|
202
|
+
name: "Prisma",
|
|
203
|
+
devDependencies: {
|
|
204
|
+
"@tsed/cli-plugin-prisma": "{{cliVersion}}"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
[FeatureType.MONGOOSE]: {
|
|
208
|
+
name: "Mongoose",
|
|
209
|
+
devDependencies: {
|
|
210
|
+
"@tsed/cli-plugin-mongoose": "{{cliVersion}}"
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
[FeatureType.TYPEORM]: {
|
|
214
|
+
name: "TypeORM",
|
|
215
|
+
devDependencies: {
|
|
216
|
+
"@tsed/cli-plugin-typeorm": "{{cliVersion}}"
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
[FeatureType.JEST]: {
|
|
220
|
+
name: "Jest",
|
|
221
|
+
devDependencies: {
|
|
222
|
+
"@tsed/cli-plugin-jest": "{{cliVersion}}"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
[FeatureType.MOCHA]: {
|
|
226
|
+
name: "Mocha + Chai + Sinon",
|
|
227
|
+
devDependencies: {
|
|
228
|
+
"@tsed/cli-plugin-mocha": "{{cliVersion}}"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
[FeatureType.ESLINT]: {
|
|
232
|
+
name: "EsLint",
|
|
233
|
+
checked: true,
|
|
234
|
+
devDependencies: {
|
|
235
|
+
"@tsed/cli-plugin-eslint": "{{cliVersion}}"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
[FeatureType.PRETTIER]: {
|
|
239
|
+
name: "Prettier"
|
|
240
|
+
},
|
|
241
|
+
[FeatureType.LINT_STAGED]: {
|
|
242
|
+
name: "Lint on commit"
|
|
243
|
+
},
|
|
244
|
+
[FeatureType.BABEL]: {
|
|
245
|
+
name: "Babel",
|
|
246
|
+
devDependencies: {
|
|
247
|
+
"@babel/cli": "latest",
|
|
248
|
+
"@babel/core": "latest",
|
|
249
|
+
"@babel/node": "latest",
|
|
250
|
+
"@babel/plugin-proposal-class-properties": "latest",
|
|
251
|
+
"@babel/plugin-proposal-decorators": "latest",
|
|
252
|
+
"@babel/preset-env": "latest",
|
|
253
|
+
"@babel/preset-typescript": "latest",
|
|
254
|
+
"babel-plugin-transform-typescript-metadata": "latest",
|
|
255
|
+
"babel-watch": "latest"
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
[FeatureType.WEBPACK]: {
|
|
259
|
+
name: "Webpack",
|
|
260
|
+
devDependencies: {
|
|
261
|
+
"@babel/cli": "latest",
|
|
262
|
+
"@babel/core": "latest",
|
|
263
|
+
"@babel/node": "latest",
|
|
264
|
+
"@babel/plugin-proposal-class-properties": "latest",
|
|
265
|
+
"@babel/plugin-proposal-decorators": "latest",
|
|
266
|
+
"@babel/preset-env": "latest",
|
|
267
|
+
"@babel/preset-typescript": "latest",
|
|
268
|
+
"babel-plugin-transform-typescript-metadata": "latest",
|
|
269
|
+
"babel-watch": "latest",
|
|
270
|
+
"babel-loader": "latest",
|
|
271
|
+
webpack: "latest",
|
|
272
|
+
"webpack-cli": "latest"
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
[PackageManager.YARN]: {
|
|
276
|
+
name: "Yarn",
|
|
277
|
+
checked: true
|
|
278
|
+
},
|
|
279
|
+
[PackageManager.NPM]: {
|
|
280
|
+
name: "NPM",
|
|
281
|
+
checked: false
|
|
282
|
+
},
|
|
283
|
+
[PackageManager.PNPM]: {
|
|
284
|
+
name: "PNPM - experimental",
|
|
285
|
+
checked: false
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
export const FeaturesPrompt = () => [
|
|
289
|
+
{
|
|
290
|
+
message: "Choose the target platform:",
|
|
291
|
+
type: "list",
|
|
292
|
+
name: "platform",
|
|
293
|
+
choices: [PlatformType.EXPRESS, PlatformType.KOA]
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
message: "Choose the architecture for your project:",
|
|
297
|
+
type: "list",
|
|
298
|
+
name: "architecture",
|
|
299
|
+
choices: [ArchitectureConvention.DEFAULT, ArchitectureConvention.FEATURE]
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
message: "Choose the convention file styling:",
|
|
303
|
+
type: "list",
|
|
304
|
+
name: "convention",
|
|
305
|
+
choices: [ProjectConvention.DEFAULT, ProjectConvention.ANGULAR]
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
type: "checkbox",
|
|
309
|
+
name: "features",
|
|
310
|
+
message: "Check the features needed for your project",
|
|
311
|
+
choices: [
|
|
312
|
+
FeatureType.GRAPHQL,
|
|
313
|
+
FeatureType.DB,
|
|
314
|
+
FeatureType.PASSPORTJS,
|
|
315
|
+
FeatureType.SOCKETIO,
|
|
316
|
+
FeatureType.SWAGGER,
|
|
317
|
+
FeatureType.OIDC,
|
|
318
|
+
FeatureType.TESTING,
|
|
319
|
+
FeatureType.LINTER,
|
|
320
|
+
FeatureType.BUNDLER,
|
|
321
|
+
FeatureType.COMMANDS
|
|
322
|
+
]
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
message: "Choose a ORM manager",
|
|
326
|
+
type: "list",
|
|
327
|
+
name: "featuresDB",
|
|
328
|
+
when: hasFeature(FeatureType.DB),
|
|
329
|
+
choices: [FeatureType.PRISMA, FeatureType.MONGOOSE, FeatureType.TYPEORM]
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
type: "list",
|
|
333
|
+
name: "featuresTypeORM",
|
|
334
|
+
message: "Which TypeORM you want to install?",
|
|
335
|
+
choices: [
|
|
336
|
+
FeatureType.TYPEORM_MYSQL,
|
|
337
|
+
FeatureType.TYPEORM_MARIADB,
|
|
338
|
+
FeatureType.TYPEORM_POSTGRES,
|
|
339
|
+
FeatureType.TYPEORM_COCKROACHDB,
|
|
340
|
+
FeatureType.TYPEORM_SQLITE,
|
|
341
|
+
FeatureType.TYPEORM_BETTER_SQLITE3,
|
|
342
|
+
FeatureType.TYPEORM_CORDOVA,
|
|
343
|
+
FeatureType.TYPEORM_NATIVESCRIPT,
|
|
344
|
+
FeatureType.TYPEORM_ORACLE,
|
|
345
|
+
FeatureType.TYPEORM_MSSQL,
|
|
346
|
+
FeatureType.TYPEORM_MONGODB,
|
|
347
|
+
FeatureType.TYPEORM_SQLJS,
|
|
348
|
+
FeatureType.TYPEORM_REACTNATIVE,
|
|
349
|
+
FeatureType.TYPEORM_EXPO
|
|
350
|
+
],
|
|
351
|
+
when: hasValue("featuresDB", FeatureType.TYPEORM)
|
|
352
|
+
},
|
|
353
|
+
// {
|
|
354
|
+
// type: "password",
|
|
355
|
+
// name: "GH_TOKEN",
|
|
356
|
+
// message:
|
|
357
|
+
// "Enter GH_TOKEN to use the premium @tsedio/prisma package or leave blank (see https://tsed.io/tutorials/prisma-client.html)",
|
|
358
|
+
// when: hasValue("featuresDB.type", "prisma")
|
|
359
|
+
// },
|
|
360
|
+
{
|
|
361
|
+
message: "Choose unit framework",
|
|
362
|
+
type: "list",
|
|
363
|
+
name: "featuresTesting",
|
|
364
|
+
when: hasFeature(FeatureType.TESTING),
|
|
365
|
+
choices: [FeatureType.JEST, FeatureType.MOCHA]
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
message: "Choose linter tools framework",
|
|
369
|
+
type: "list",
|
|
370
|
+
name: "featuresLinter",
|
|
371
|
+
when: hasFeature(FeatureType.LINTER),
|
|
372
|
+
choices: [FeatureType.ESLINT]
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
message: "Choose extra linter tools",
|
|
376
|
+
type: "checkbox",
|
|
377
|
+
name: "featuresExtraLinter",
|
|
378
|
+
when: hasFeature(FeatureType.LINTER),
|
|
379
|
+
choices: [FeatureType.PRETTIER, FeatureType.LINT_STAGED]
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
message: "Choose your bundler",
|
|
383
|
+
type: "list",
|
|
384
|
+
name: "featuresBundler",
|
|
385
|
+
when: hasFeature(FeatureType.BUNDLER),
|
|
386
|
+
choices: [FeatureType.BABEL, FeatureType.WEBPACK]
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
message: "Choose the OIDC base path server",
|
|
390
|
+
name: "oidcBasePath",
|
|
391
|
+
default: "/oidc",
|
|
392
|
+
when: hasFeature(FeatureType.OIDC),
|
|
393
|
+
type: "input"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
message: "Choose the package manager:",
|
|
397
|
+
type: "list",
|
|
398
|
+
name: "packageManager",
|
|
399
|
+
choices: [PackageManager.YARN, PackageManager.NPM, PackageManager.PNPM]
|
|
400
|
+
}
|
|
401
|
+
];
|
|
402
|
+
//# sourceMappingURL=FeaturesPrompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeaturesPrompt.js","sourceRoot":"","sources":["../../../../../src/commands/init/config/FeaturesPrompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAC,sBAAsB,EAAE,YAAY,EAAE,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAW5F,MAAM,CAAN,IAAY,WA4CX;AA5CD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,wCAAyB,CAAA;IACzB,oCAAqB,CAAA;IACrB,wBAAS,CAAA;IAET,MAAM;IACN,gCAAiB,CAAA;IAEjB,oCAAqB,CAAA;IAErB,UAAU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EAAE,kCAAkC;QAC3C,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,EAAE,OAAO;KACd;IACD;QACE,OAAO,EAAE,6BAA6B;QACtC,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC;KACxE;CACF,CAAC","sourcesContent":["import {PackageManager} from \"@tsed/cli-core\";\nimport {isPlatform} from \"../utils/isPlatform\";\nimport {hasFeature, hasValue} from \"../utils/hasFeature\";\nimport {InitOptions} from \"../interfaces/InitOptions\";\nimport {ArchitectureConvention, PlatformType, ProjectConvention} from \"../../../interfaces\";\n\nexport interface Feature {\n name: string;\n value?: any;\n checked?: boolean | ((opts: Partial<InitOptions>) => boolean);\n when?: (opts: any) => boolean;\n dependencies?: Record<string, any>;\n devDependencies?: Record<string, any>;\n}\n\nexport enum FeatureType {\n GRAPHQL = \"graphql\",\n SOCKETIO = \"socketio\",\n SWAGGER = \"swagger\",\n OIDC = \"oidc\",\n PASSPORTJS = \"passportjs\",\n COMMANDS = \"commands\",\n DB = \"db\",\n\n // ORM\n PRISMA = \"prisma\",\n\n MONGOOSE = \"mongoose\",\n\n // TYPEORM\n TYPEORM = \"typeorm\",\n TYPEORM_MYSQL = \"typeorm:mysql\",\n TYPEORM_MARIADB = \"typeorm:mariadb\",\n TYPEORM_POSTGRES = \"typeorm:postgres\",\n TYPEORM_COCKROACHDB = \"typeorm:cockroachdb\",\n TYPEORM_SQLITE = \"typeorm:sqlite\",\n TYPEORM_BETTER_SQLITE3 = \"typeorm:better-sqlite3\",\n TYPEORM_CORDOVA = \"typeorm:cordova\",\n TYPEORM_NATIVESCRIPT = \"typeorm:nativescript\",\n TYPEORM_ORACLE = \"typeorm:oracle\",\n TYPEORM_MSSQL = \"typeorm:mssql\",\n TYPEORM_MONGODB = \"typeorm:mongodb\",\n TYPEORM_SQLJS = \"typeorm:sqljs\",\n TYPEORM_REACTNATIVE = \"typeorm:reactnative\",\n TYPEORM_EXPO = \"typeorm:expo\",\n\n // TESTING\n TESTING = \"testing\",\n JEST = \"jest\",\n MOCHA = \"mocha\",\n LINTER = \"linter\",\n ESLINT = \"eslint\",\n LINT_STAGED = \"lintstaged\",\n PRETTIER = \"prettier\",\n\n // BUNDLER\n BUNDLER = \"bundler\",\n BABEL = \"babel\",\n WEBPACK = \"babel:webpack\"\n}\n\nexport const FeaturesMap: Record<string, Feature> = {\n [PlatformType.EXPRESS]: {\n name: \"Express.js\",\n checked: (options: any) => options.platform !== PlatformType.KOA\n },\n [PlatformType.KOA]: {\n name: \"Koa.js\",\n checked: (options: any) => options.platform === PlatformType.KOA\n },\n [FeatureType.GRAPHQL]: {\n name: \"TypeGraphQL\",\n dependencies: {\n \"@tsed/typegraphql\": \"{{tsedVersion}}\"\n },\n devDependencies: {\n \"@tsed/cli-plugin-typegraphql\": \"{{cliVersion}}\"\n }\n },\n [FeatureType.DB]: {\n name: \"Database\"\n },\n [FeatureType.PASSPORTJS]: {\n name: \"Passport.js\",\n when: isPlatform(PlatformType.EXPRESS),\n devDependencies: {\n \"@tsed/cli-plugin-passport\": \"{{cliVersion}}\"\n }\n },\n [FeatureType.SOCKETIO]: {\n name: \"Socket.io\",\n dependencies: {\n \"@tsed/socketio\": \"{{tsedVersion}}\",\n \"socket.io\": \"latest\"\n }\n },\n [FeatureType.SWAGGER]: {\n name: \"Swagger\",\n dependencies: {\n \"@tsed/swagger\": \"{{tsedVersion}}\"\n }\n },\n [FeatureType.OIDC]: {\n name: \"OpenID Connect provider\",\n devDependencies: {\n \"@tsed/cli-plugin-oidc-provider\": \"{{cliVersion}}\"\n }\n },\n [FeatureType.TESTING]: {\n name: \"Testing\",\n dependencies: {},\n devDependencies: {\n \"@types/supertest\": \"latest\",\n supertest: \"latest\"\n }\n },\n [FeatureType.LINTER]: {\n name: \"Linter\"\n },\n [FeatureType.BUNDLER]: {\n name: \"Bundler\"\n },\n [FeatureType.COMMANDS]: {\n name: \"Commands\",\n dependencies: {\n \"@tsed/cli-core\": \"{{cliVersion}}\"\n },\n devDependencies: {\n \"@types/inquirer\": \"latest\"\n }\n },\n\n [ProjectConvention.DEFAULT]: {\n name: \"Ts.ED\",\n checked: true\n },\n [ProjectConvention.ANGULAR]: {\n name: \"Angular\",\n checked: false\n },\n [ArchitectureConvention.DEFAULT]: {\n name: \"Ts.ED\",\n checked: true\n },\n [ArchitectureConvention.FEATURE]: {\n name: \"feature\",\n checked: false\n },\n [FeatureType.TYPEORM_MYSQL]: {\n name: \"MySQL\",\n dependencies: {\n mysql2: \"latest\"\n }\n },\n [FeatureType.TYPEORM_MARIADB]: {\n name: \"MariaDB\",\n dependencies: {\n mariadb: \"latest\"\n }\n },\n [FeatureType.TYPEORM_POSTGRES]: {\n name: \"Postgres\",\n dependencies: {\n pg: \"latest\"\n }\n },\n [FeatureType.TYPEORM_COCKROACHDB]: {\n name: \"CockRoachDB\",\n dependencies: {\n cockroachdb: \"latest\"\n }\n },\n [FeatureType.TYPEORM_SQLITE]: {\n name: \"SQLite\",\n dependencies: {\n sqlite3: \"latest\"\n }\n },\n [FeatureType.TYPEORM_BETTER_SQLITE3]: {\n name: \"Better SQLite3\",\n dependencies: {\n \"better-sqlite3\": \"latest\"\n }\n },\n [FeatureType.TYPEORM_CORDOVA]: {\n name: \"Cordova\"\n },\n [FeatureType.TYPEORM_NATIVESCRIPT]: {\n name: \"NativeScript\"\n },\n [FeatureType.TYPEORM_ORACLE]: {\n name: \"Oracle\",\n dependencies: {\n oracledb: \"latest\"\n }\n },\n [FeatureType.TYPEORM_MSSQL]: {\n name: \"MsSQL\",\n\n dependencies: {\n mssql: \"latest\"\n }\n },\n [FeatureType.TYPEORM_MONGODB]: {\n name: \"MongoDB\",\n dependencies: {\n mongodb: \"latest\"\n }\n },\n [FeatureType.TYPEORM_SQLJS]: {\n name: \"SQL.js\"\n },\n [FeatureType.TYPEORM_REACTNATIVE]: {\n name: \"ReactNative\"\n },\n [FeatureType.TYPEORM_EXPO]: {\n name: \"Expo\"\n },\n [FeatureType.PRISMA]: {\n name: \"Prisma\",\n devDependencies: {\n \"@tsed/cli-plugin-prisma\": \"{{cliVersion}}\"\n }\n },\n [FeatureType.MONGOOSE]: {\n name: \"Mongoose\",\n\n devDependencies: {\n \"@tsed/cli-plugin-mongoose\": \"{{cliVersion}}\"\n }\n },\n [FeatureType.TYPEORM]: {\n name: \"TypeORM\",\n devDependencies: {\n \"@tsed/cli-plugin-typeorm\": \"{{cliVersion}}\"\n }\n },\n [FeatureType.JEST]: {\n name: \"Jest\",\n devDependencies: {\n \"@tsed/cli-plugin-jest\": \"{{cliVersion}}\"\n }\n },\n [FeatureType.MOCHA]: {\n name: \"Mocha + Chai + Sinon\",\n devDependencies: {\n \"@tsed/cli-plugin-mocha\": \"{{cliVersion}}\"\n }\n },\n [FeatureType.ESLINT]: {\n name: \"EsLint\",\n checked: true,\n devDependencies: {\n \"@tsed/cli-plugin-eslint\": \"{{cliVersion}}\"\n }\n },\n [FeatureType.PRETTIER]: {\n name: \"Prettier\"\n },\n [FeatureType.LINT_STAGED]: {\n name: \"Lint on commit\"\n },\n [FeatureType.BABEL]: {\n name: \"Babel\",\n devDependencies: {\n \"@babel/cli\": \"latest\",\n \"@babel/core\": \"latest\",\n \"@babel/node\": \"latest\",\n \"@babel/plugin-proposal-class-properties\": \"latest\",\n \"@babel/plugin-proposal-decorators\": \"latest\",\n \"@babel/preset-env\": \"latest\",\n \"@babel/preset-typescript\": \"latest\",\n \"babel-plugin-transform-typescript-metadata\": \"latest\",\n \"babel-watch\": \"latest\"\n }\n },\n [FeatureType.WEBPACK]: {\n name: \"Webpack\",\n devDependencies: {\n \"@babel/cli\": \"latest\",\n \"@babel/core\": \"latest\",\n \"@babel/node\": \"latest\",\n \"@babel/plugin-proposal-class-properties\": \"latest\",\n \"@babel/plugin-proposal-decorators\": \"latest\",\n \"@babel/preset-env\": \"latest\",\n \"@babel/preset-typescript\": \"latest\",\n \"babel-plugin-transform-typescript-metadata\": \"latest\",\n \"babel-watch\": \"latest\",\n \"babel-loader\": \"latest\",\n webpack: \"latest\",\n \"webpack-cli\": \"latest\"\n }\n },\n [PackageManager.YARN]: {\n name: \"Yarn\",\n checked: true\n },\n [PackageManager.NPM]: {\n name: \"NPM\",\n checked: false\n },\n [PackageManager.PNPM]: {\n name: \"PNPM - experimental\",\n checked: false\n }\n};\n\nexport const FeaturesPrompt = () => [\n {\n message: \"Choose the target platform:\",\n type: \"list\",\n name: \"platform\",\n choices: [PlatformType.EXPRESS, PlatformType.KOA]\n },\n {\n message: \"Choose the architecture for your project:\",\n type: \"list\",\n name: \"architecture\",\n choices: [ArchitectureConvention.DEFAULT, ArchitectureConvention.FEATURE]\n },\n {\n message: \"Choose the convention file styling:\",\n type: \"list\",\n name: \"convention\",\n choices: [ProjectConvention.DEFAULT, ProjectConvention.ANGULAR]\n },\n {\n type: \"checkbox\",\n name: \"features\",\n message: \"Check the features needed for your project\",\n choices: [\n FeatureType.GRAPHQL,\n FeatureType.DB,\n FeatureType.PASSPORTJS,\n FeatureType.SOCKETIO,\n FeatureType.SWAGGER,\n FeatureType.OIDC,\n FeatureType.TESTING,\n FeatureType.LINTER,\n FeatureType.BUNDLER,\n FeatureType.COMMANDS\n ]\n },\n {\n message: \"Choose a ORM manager\",\n type: \"list\",\n name: \"featuresDB\",\n when: hasFeature(FeatureType.DB),\n choices: [FeatureType.PRISMA, FeatureType.MONGOOSE, FeatureType.TYPEORM]\n },\n {\n type: \"list\",\n name: \"featuresTypeORM\",\n message: \"Which TypeORM you want to install?\",\n choices: [\n FeatureType.TYPEORM_MYSQL,\n FeatureType.TYPEORM_MARIADB,\n FeatureType.TYPEORM_POSTGRES,\n FeatureType.TYPEORM_COCKROACHDB,\n FeatureType.TYPEORM_SQLITE,\n FeatureType.TYPEORM_BETTER_SQLITE3,\n FeatureType.TYPEORM_CORDOVA,\n FeatureType.TYPEORM_NATIVESCRIPT,\n FeatureType.TYPEORM_ORACLE,\n FeatureType.TYPEORM_MSSQL,\n FeatureType.TYPEORM_MONGODB,\n FeatureType.TYPEORM_SQLJS,\n FeatureType.TYPEORM_REACTNATIVE,\n FeatureType.TYPEORM_EXPO\n ],\n when: hasValue(\"featuresDB\", FeatureType.TYPEORM)\n },\n // {\n // type: \"password\",\n // name: \"GH_TOKEN\",\n // message:\n // \"Enter GH_TOKEN to use the premium @tsedio/prisma package or leave blank (see https://tsed.io/tutorials/prisma-client.html)\",\n // when: hasValue(\"featuresDB.type\", \"prisma\")\n // },\n {\n message: \"Choose unit framework\",\n type: \"list\",\n name: \"featuresTesting\",\n when: hasFeature(FeatureType.TESTING),\n choices: [FeatureType.JEST, FeatureType.MOCHA]\n },\n {\n message: \"Choose linter tools framework\",\n type: \"list\",\n name: \"featuresLinter\",\n when: hasFeature(FeatureType.LINTER),\n choices: [FeatureType.ESLINT]\n },\n {\n message: \"Choose extra linter tools\",\n type: \"checkbox\",\n name: \"featuresExtraLinter\",\n when: hasFeature(FeatureType.LINTER),\n choices: [FeatureType.PRETTIER, FeatureType.LINT_STAGED]\n },\n {\n message: \"Choose your bundler\",\n type: \"list\",\n name: \"featuresBundler\",\n when: hasFeature(FeatureType.BUNDLER),\n choices: [FeatureType.BABEL, FeatureType.WEBPACK]\n },\n {\n message: \"Choose the OIDC base path server\",\n name: \"oidcBasePath\",\n default: \"/oidc\",\n when: hasFeature(FeatureType.OIDC),\n type: \"input\"\n },\n {\n message: \"Choose the package manager:\",\n type: \"list\",\n name: \"packageManager\",\n choices: [PackageManager.YARN, PackageManager.NPM, PackageManager.PNPM]\n }\n];\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { PackageManager } from "@tsed/cli-core";
|
|
2
|
+
import { ArchitectureConvention, PlatformType, ProjectConvention } from "../../../interfaces.js";
|
|
3
|
+
import { FeatureType } from "./FeaturesPrompt.js";
|
|
4
|
+
export const InitFileSchema = {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
tsedVersion: {
|
|
8
|
+
type: "string"
|
|
9
|
+
},
|
|
10
|
+
projectName: {
|
|
11
|
+
type: "string",
|
|
12
|
+
maxLength: 100
|
|
13
|
+
},
|
|
14
|
+
platform: {
|
|
15
|
+
type: "string",
|
|
16
|
+
description: "The project name. By default, the project is the same as the name directory.",
|
|
17
|
+
enum: Object.values(PlatformType),
|
|
18
|
+
default: PlatformType.EXPRESS
|
|
19
|
+
},
|
|
20
|
+
architecture: {
|
|
21
|
+
type: "string",
|
|
22
|
+
enum: Object.values(ArchitectureConvention),
|
|
23
|
+
default: ArchitectureConvention.DEFAULT
|
|
24
|
+
},
|
|
25
|
+
convention: {
|
|
26
|
+
type: "string",
|
|
27
|
+
enum: Object.values(ProjectConvention),
|
|
28
|
+
default: ProjectConvention.DEFAULT
|
|
29
|
+
},
|
|
30
|
+
features: {
|
|
31
|
+
type: "array",
|
|
32
|
+
items: {
|
|
33
|
+
type: "string",
|
|
34
|
+
enum: Object.values(FeatureType)
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
packageManager: {
|
|
38
|
+
type: "string",
|
|
39
|
+
enum: Object.values(PackageManager),
|
|
40
|
+
default: PackageManager.YARN
|
|
41
|
+
},
|
|
42
|
+
skipPrompt: {
|
|
43
|
+
type: "boolean",
|
|
44
|
+
default: false
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
required: ["features"],
|
|
48
|
+
additionalProperties: true
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=InitFileSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InitFileSchema.js","sourceRoot":"","sources":["../../../../../src/commands/init/config/InitFileSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAC,sBAAs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ectureConvention, PlatformType, ProjectConvention} from \"../../../interfaces\";\nimport {FeatureType} from \"./FeaturesPrompt\";\n\nexport const InitFileSchema = {\n type: \"object\",\n properties: {\n tsedVersion: {\n type: \"string\"\n },\n projectName: {\n type: \"string\",\n maxLength: 100\n },\n platform: {\n type: \"string\",\n description: \"The project name. By default, the project is the same as the name directory.\",\n enum: Object.values(PlatformType),\n default: PlatformType.EXPRESS\n },\n architecture: {\n type: \"string\",\n enum: Object.values(ArchitectureConvention),\n default: ArchitectureConvention.DEFAULT\n },\n convention: {\n type: \"string\",\n enum: Object.values(ProjectConvention),\n default: ProjectConvention.DEFAULT\n },\n features: {\n type: \"array\",\n items: {\n type: \"string\",\n enum: Object.values(FeatureType)\n }\n },\n packageManager: {\n type: \"string\",\n enum: Object.values(PackageManager),\n default: PackageManager.YARN\n },\n skipPrompt: {\n type: \"boolean\",\n default: false\n }\n },\n required: [\"features\"],\n additionalProperties: true\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InitCmdContext.js","sourceRoot":"","sources":["../../../../../src/commands/init/interfaces/InitCmdContext.ts"],"names":[],"mappings":"","sourcesContent":["import {CliDefaultOptions} from \"@tsed/cli-core\";\nimport {InitOptions} from \"./InitOptions\";\n\nexport interface InitCmdContext extends InitOptions, CliDefaultOptions, Record<string, any> {\n root: string;\n srcDir: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InitOptions.js","sourceRoot":"","sources":["../../../../../src/commands/init/interfaces/InitOptions.ts"],"names":[],"mappings":"","sourcesContent":["import {PackageManager} from \"@tsed/cli-core\";\nimport {PlatformType} from \"../../../interfaces/PlatformType\";\nimport {ArchitectureConvention} from \"../../../interfaces/ArchitectureConvention\";\nimport {ProjectConvention} from \"../../../interfaces/ProjectConvention\";\nimport {FeatureType} from \"../config/FeaturesPrompt\";\n\nexport interface InitOptions {\n root: string;\n projectName: string;\n features: FeatureType[];\n skipPrompt: boolean;\n platform: PlatformType;\n tsedVersion: string;\n cliVersion: string;\n architecture: ArchitectureConvention;\n convention: ProjectConvention;\n packageManager: PackageManager;\n oidcBasePath: string;\n file: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InitPromptAnswers.js","sourceRoot":"","sources":["../../../../../src/commands/init/interfaces/InitPromptAnswers.ts"],"names":[],"mappings":"","sourcesContent":["import {PackageManager} from \"@tsed/cli-core\";\nimport {ArchitectureConvention, PlatformType, ProjectConvention} from \"../../../interfaces\";\n\nexport interface InitPromptAnswers {\n projectName: string;\n platform: PlatformType;\n architecture: ArchitectureConvention;\n convention: ProjectConvention;\n features: string[];\n featuresDB: string[];\n featuresTypeORM: string;\n featuresTesting: string;\n featuresExtraLinter: string[];\n featuresBundler: string;\n oidcBasePath: string;\n packageManager: PackageManager;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { camelCase } from "change-case";
|
|
2
|
+
import { mapUniqFeatures } from "./mapUniqFeatures.js";
|
|
3
|
+
export function mapToContext(options) {
|
|
4
|
+
options = mapUniqFeatures(options);
|
|
5
|
+
options.features.forEach((feature) => {
|
|
6
|
+
feature.split(":").forEach((type) => {
|
|
7
|
+
options[camelCase(type)] = true;
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
return options;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=mapToContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapToContext.js","sourceRoot":"","sources":["../../../../../src/commands/init/mappers/mapToContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,MAAM,UAAU,YAAY,CAAC,OAAY;IACvC,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAEnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAe,EAAE,EAAE;QAC3C,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAClC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import {camelCase} from \"change-case\";\nimport {InitCmdContext} from \"../interfaces/InitCmdContext\";\nimport {mapUniqFeatures} from \"./mapUniqFeatures\";\n\nexport function mapToContext(options: any): InitCmdContext {\n options = mapUniqFeatures(options);\n\n options.features.forEach((feature: string) => {\n feature.split(\":\").forEach((type) => {\n options[camelCase(type)] = true;\n });\n });\n\n return options;\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function mapUniqFeatures(answers) {
|
|
2
|
+
const features = [];
|
|
3
|
+
Object.entries(answers)
|
|
4
|
+
.filter(([key]) => key.startsWith("features"))
|
|
5
|
+
.forEach(([key, value]) => {
|
|
6
|
+
delete answers[key];
|
|
7
|
+
features.push(...[].concat(value));
|
|
8
|
+
});
|
|
9
|
+
return {
|
|
10
|
+
...answers,
|
|
11
|
+
features: [...new Set(features).values()]
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=mapUniqFeatures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapUniqFeatures.js","sourceRoot":"","sources":["../../../../../src/commands/init/mappers/mapUniqFeatures.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,eAAe,CAAC,OAAgC;IAC9D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;SAC7C,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAQ,EAAE,EAAE;QAC/B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;QACpB,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEL,OAAO;QACL,GAAG,OAAO;QACV,QAAQ,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAkB;KAC3D,CAAC;AACJ,CAAC","sourcesContent":["import {InitPromptAnswers} from \"../interfaces/InitPromptAnswers\";\nimport {InitOptions} from \"../interfaces/InitOptions\";\nimport {FeatureType} from \"../config/FeaturesPrompt\";\n\nexport function mapUniqFeatures(answers: InitPromptAnswers & any): InitOptions {\n const features: string[] = [];\n\n Object.entries(answers)\n .filter(([key]) => key.startsWith(\"features\"))\n .forEach(([key, value]: any[]) => {\n delete answers[key];\n features.push(...[].concat(value));\n });\n\n return {\n ...answers,\n features: [...new Set(features).values()] as FeatureType[]\n };\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cleanObject, isFunction } from "@tsed/core";
|
|
2
|
+
import { FeaturesMap, FeaturesPrompt } from "../config/FeaturesPrompt.js";
|
|
3
|
+
function mapChoices(item, options) {
|
|
4
|
+
return item.choices.map((choice) => {
|
|
5
|
+
const { checked } = FeaturesMap[choice];
|
|
6
|
+
return cleanObject({
|
|
7
|
+
...FeaturesMap[choice],
|
|
8
|
+
value: choice,
|
|
9
|
+
checked: isFunction(checked) ? checked(options) : checked
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export function getFeaturesPrompt(options) {
|
|
14
|
+
return FeaturesPrompt().map((item) => {
|
|
15
|
+
return cleanObject({
|
|
16
|
+
...item,
|
|
17
|
+
choices: item.choices?.length ? mapChoices(item, options) : undefined
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=getFeaturesPrompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFeaturesPrompt.js","sourceRoot":"","sources":["../../../../../src/commands/init/prompts/getFeaturesPrompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,0BAA0B,CAAC;AAGrE,SAAS,UAAU,CAAC,IAAS,EAAE,OAA6B;IAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAc,EAAE,EAAE;QACzC,MAAM,EAAC,OAAO,EAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QAEtC,OAAO,WAAW,CAAC;YACjB,GAAG,WAAW,CAAC,MAAM,CAAC;YACtB,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO;SAC1D,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAA6B;IAC7D,OAAO,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE;QACxC,OAAO,WAAW,CAAC;YACjB,GAAG,IAAI;YACP,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;SACtE,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {cleanObject, isFunction} from \"@tsed/core\";\nimport {FeaturesMap, FeaturesPrompt} from \"../config/FeaturesPrompt\";\nimport {InitOptions} from \"../interfaces/InitOptions\";\n\nfunction mapChoices(item: any, options: Partial<InitOptions>) {\n return item.choices.map((choice: string) => {\n const {checked} = FeaturesMap[choice];\n\n return cleanObject({\n ...FeaturesMap[choice],\n value: choice,\n checked: isFunction(checked) ? checked(options) : checked\n });\n });\n}\n\nexport function getFeaturesPrompt(options: Partial<InitOptions>) {\n return FeaturesPrompt().map((item: any) => {\n return cleanObject({\n ...item,\n choices: item.choices?.length ? mapChoices(item, options) : undefined\n });\n });\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getValue } from "@tsed/core";
|
|
2
|
+
export function hasValue(expression, value) {
|
|
3
|
+
return (ctx) => getValue(expression, ctx) === value;
|
|
4
|
+
}
|
|
5
|
+
export function hasFeature(feature) {
|
|
6
|
+
return (ctx) => !!ctx.features.find((item) => item === feature);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=hasFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasFeature.js","sourceRoot":"","sources":["../../../../../src/commands/init/utils/hasFeature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,UAAU,QAAQ,CAAC,UAAkB,EAAE,KAAU;IACrD,OAAO,CAAC,GAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,OAAO,CAAC,GAAQ,EAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;AACxF,CAAC","sourcesContent":["import {getValue} from \"@tsed/core\";\n\nexport function hasValue(expression: string, value: any) {\n return (ctx: any) => getValue(expression, ctx) === value;\n}\n\nexport function hasFeature(feature: string) {\n return (ctx: any): boolean => !!ctx.features.find((item: string) => item === feature);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPlatform.js","sourceRoot":"","sources":["../../../../../src/commands/init/utils/isPlatform.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,GAAG,KAAe;IAC3C,OAAO,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACtD,CAAC","sourcesContent":["export function isPlatform(...types: string[]) {\n return (ctx: any) => [types].includes(ctx.platform);\n}\n"]}
|
|
@@ -6,9 +6,9 @@ const { path, packageJson } = readPkgUp.sync({
|
|
|
6
6
|
cwd: join(dir, "..", "..")
|
|
7
7
|
});
|
|
8
8
|
export const PKG = packageJson;
|
|
9
|
-
export const MINIMAL_TSED_VERSION = "
|
|
10
|
-
export const DEFAULT_TSED_TAGS = "
|
|
9
|
+
export const MINIMAL_TSED_VERSION = "7";
|
|
10
|
+
export const DEFAULT_TSED_TAGS = "rc";
|
|
11
11
|
export const IGNORE_VERSIONS = ["6.0.0"];
|
|
12
|
-
export const IGNORE_TAGS =
|
|
12
|
+
export const IGNORE_TAGS = /rc/; // /alpha|beta/
|
|
13
13
|
export const TEMPLATE_DIR = join(dirname(path), "templates");
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AACnC,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,WAAW,MAAM,aAAa,CAAC;AAEtC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,WAAW,EAAE,CAAC;AAE9B,MAAM,EAAC,IAAI,EAAE,WAAW,EAAC,GAAG,SAAS,CAAC,IAAI,CAAC;IACzC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC;CAC3B,CAAE,CAAC;AAEJ,MAAM,CAAC,MAAM,GAAG,GAAG,WAAW,CAAC;AAC/B,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AACnC,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,WAAW,MAAM,aAAa,CAAC;AAEtC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,WAAW,EAAE,CAAC;AAE9B,MAAM,EAAC,IAAI,EAAE,WAAW,EAAC,GAAG,SAAS,CAAC,IAAI,CAAC;IACzC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC;CAC3B,CAAE,CAAC;AAEJ,MAAM,CAAC,MAAM,GAAG,GAAG,WAAW,CAAC;AAC/B,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AACtC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,WAAW,GAAmB,IAAI,CAAC,CAAC,eAAe;AAChE,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import {dirname, join} from \"path\";\nimport readPkgUp from \"read-pkg-up\";\nimport filedirname from \"filedirname\";\n\nconst [, dir] = filedirname();\n\nconst {path, packageJson} = readPkgUp.sync({\n cwd: join(dir, \"..\", \"..\")\n})!;\n\nexport const PKG = packageJson;\nexport const MINIMAL_TSED_VERSION = \"7\";\nexport const DEFAULT_TSED_TAGS = \"rc\";\nexport const IGNORE_VERSIONS = [\"6.0.0\"];\nexport const IGNORE_TAGS: false | RegExp = /rc/; // /alpha|beta/\nexport const TEMPLATE_DIR = join(dirname(path), \"templates\");\n"]}
|