@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
|
@@ -1,528 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFeaturesChoicesValues = exports.parseFeaturesFile = exports.FEATURES_TYPEORM_CONNECTION_TYPES = exports.isPlatform = exports.hasValue = exports.hasFeature = exports.Features = void 0;
|
|
4
|
-
const cli_core_1 = require("@tsed/cli-core");
|
|
5
|
-
const core_1 = require("@tsed/core");
|
|
6
|
-
const interfaces_1 = require("../interfaces");
|
|
7
|
-
function Features() {
|
|
8
|
-
return (0, cli_core_1.Inject)(Features);
|
|
9
|
-
}
|
|
10
|
-
exports.Features = Features;
|
|
11
|
-
function hasFeature(feature) {
|
|
12
|
-
return (ctx) => !!ctx.features.find((item) => item.type === feature);
|
|
13
|
-
}
|
|
14
|
-
exports.hasFeature = hasFeature;
|
|
15
|
-
function hasValue(expression, value) {
|
|
16
|
-
return (ctx) => (0, core_1.getValue)(expression, ctx) === value;
|
|
17
|
-
}
|
|
18
|
-
exports.hasValue = hasValue;
|
|
19
|
-
function isPlatform(...types) {
|
|
20
|
-
return (ctx) => [types].includes(ctx.platform);
|
|
21
|
-
}
|
|
22
|
-
exports.isPlatform = isPlatform;
|
|
23
|
-
exports.FEATURES_TYPEORM_CONNECTION_TYPES = [
|
|
24
|
-
{
|
|
25
|
-
name: "MySQL",
|
|
26
|
-
value: {
|
|
27
|
-
type: "typeorm:mysql",
|
|
28
|
-
dependencies: {
|
|
29
|
-
mysql2: "latest"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: "MariaDB",
|
|
35
|
-
value: {
|
|
36
|
-
type: "typeorm:mariadb",
|
|
37
|
-
dependencies: {
|
|
38
|
-
mariadb: "latest"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: "Postgres",
|
|
44
|
-
value: {
|
|
45
|
-
type: "typeorm:postgres",
|
|
46
|
-
dependencies: {
|
|
47
|
-
pg: "latest"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "CockRoachDB",
|
|
53
|
-
value: {
|
|
54
|
-
type: "typeorm:postgres",
|
|
55
|
-
dependencies: {
|
|
56
|
-
cockroachdb: "latest"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "SQLite",
|
|
62
|
-
value: {
|
|
63
|
-
type: "typeorm:sqlite",
|
|
64
|
-
dependencies: {
|
|
65
|
-
sqlite3: "latest"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: "Better SQLite3",
|
|
71
|
-
value: {
|
|
72
|
-
type: "typeorm:better-sqlite3",
|
|
73
|
-
dependencies: {
|
|
74
|
-
"better-sqlite3": "latest"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: "Cordova",
|
|
80
|
-
value: {
|
|
81
|
-
type: "typeorm:cordova"
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "NativeScript",
|
|
86
|
-
value: {
|
|
87
|
-
type: "typeorm:nativescript"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: "Oracle",
|
|
92
|
-
value: {
|
|
93
|
-
type: "typeorm:oracle",
|
|
94
|
-
dependencies: {
|
|
95
|
-
oracledb: "latest"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: "MsSQL",
|
|
101
|
-
value: {
|
|
102
|
-
type: "typeorm:mssql",
|
|
103
|
-
dependencies: {
|
|
104
|
-
mssql: "latest"
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: "MongoDB",
|
|
110
|
-
value: {
|
|
111
|
-
type: "typeorm:mongodb",
|
|
112
|
-
dependencies: {
|
|
113
|
-
mongodb: "latest"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
name: "SQL.js",
|
|
119
|
-
value: {
|
|
120
|
-
type: "typeorm:sqljs",
|
|
121
|
-
dependencies: {}
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: "ReactNative",
|
|
126
|
-
value: {
|
|
127
|
-
type: "typeorm:reactnative",
|
|
128
|
-
dependencies: {}
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
name: "Expo",
|
|
133
|
-
value: {
|
|
134
|
-
type: "typeorm:expo",
|
|
135
|
-
dependencies: {}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
];
|
|
139
|
-
const babelDevDependencies = {
|
|
140
|
-
"@babel/cli": "latest",
|
|
141
|
-
"@babel/core": "latest",
|
|
142
|
-
"@babel/node": "latest",
|
|
143
|
-
"@babel/plugin-proposal-class-properties": "latest",
|
|
144
|
-
"@babel/plugin-proposal-decorators": "latest",
|
|
145
|
-
"@babel/preset-env": "latest",
|
|
146
|
-
"@babel/preset-typescript": "latest",
|
|
147
|
-
"babel-plugin-transform-typescript-metadata": "latest",
|
|
148
|
-
"babel-watch": "latest"
|
|
149
|
-
};
|
|
150
|
-
const platformChoices = [
|
|
151
|
-
{
|
|
152
|
-
name: "Express.js",
|
|
153
|
-
checked: true,
|
|
154
|
-
value: "express"
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: "Koa.js",
|
|
158
|
-
checked: false,
|
|
159
|
-
value: "koa"
|
|
160
|
-
}
|
|
161
|
-
];
|
|
162
|
-
const conventionChoices = [
|
|
163
|
-
{
|
|
164
|
-
name: "Ts.ED",
|
|
165
|
-
checked: true,
|
|
166
|
-
value: interfaces_1.ProjectConvention.DEFAULT
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
name: "Angular",
|
|
170
|
-
checked: false,
|
|
171
|
-
value: interfaces_1.ProjectConvention.ANGULAR
|
|
172
|
-
}
|
|
173
|
-
];
|
|
174
|
-
const featureChoices = (cliVersion) => [
|
|
175
|
-
{
|
|
176
|
-
name: "TypeGraphQL",
|
|
177
|
-
value: {
|
|
178
|
-
type: "graphql",
|
|
179
|
-
dependencies: {
|
|
180
|
-
"@tsed/typegraphql": "{{tsedVersion}}"
|
|
181
|
-
},
|
|
182
|
-
devDependencies: {
|
|
183
|
-
"@tsed/cli-plugin-typegraphql": cliVersion
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
name: "Database",
|
|
189
|
-
value: { type: "db" }
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
name: "Passport.js",
|
|
193
|
-
when: isPlatform("express"),
|
|
194
|
-
value: {
|
|
195
|
-
type: "passportjs",
|
|
196
|
-
devDependencies: {
|
|
197
|
-
"@tsed/cli-plugin-passport": cliVersion
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
name: "Socket.io",
|
|
203
|
-
value: {
|
|
204
|
-
type: "socketio",
|
|
205
|
-
dependencies: {
|
|
206
|
-
"@tsed/socketio": "{{tsedVersion}}",
|
|
207
|
-
"socket.io": "latest"
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
name: "Swagger",
|
|
213
|
-
value: {
|
|
214
|
-
type: "swagger",
|
|
215
|
-
dependencies: {
|
|
216
|
-
"@tsed/swagger": "{{tsedVersion}}"
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
name: "OpenID Connect provider",
|
|
222
|
-
value: {
|
|
223
|
-
type: "oidc",
|
|
224
|
-
devDependencies: {
|
|
225
|
-
"@tsed/cli-plugin-oidc-provider": cliVersion
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
name: "Testing",
|
|
231
|
-
value: {
|
|
232
|
-
type: "testing",
|
|
233
|
-
dependencies: {},
|
|
234
|
-
devDependencies: {
|
|
235
|
-
"@types/supertest": "latest",
|
|
236
|
-
supertest: "latest"
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
name: "Linter",
|
|
242
|
-
value: {
|
|
243
|
-
type: "linter"
|
|
244
|
-
}
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
name: "Bundler",
|
|
248
|
-
value: {
|
|
249
|
-
type: "bundler"
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
name: "Commands",
|
|
254
|
-
value: {
|
|
255
|
-
type: "commands",
|
|
256
|
-
dependencies: {
|
|
257
|
-
"@tsed/cli-core": cliVersion
|
|
258
|
-
},
|
|
259
|
-
devDependencies: {
|
|
260
|
-
"@types/inquirer": "latest"
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
];
|
|
265
|
-
const featuresDbChoices = (cliVersion) => [
|
|
266
|
-
{
|
|
267
|
-
name: "Prisma",
|
|
268
|
-
value: {
|
|
269
|
-
type: "prisma",
|
|
270
|
-
devDependencies: {
|
|
271
|
-
"@tsed/cli-plugin-prisma": cliVersion
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
name: "Mongoose",
|
|
277
|
-
value: {
|
|
278
|
-
type: "mongoose",
|
|
279
|
-
devDependencies: {
|
|
280
|
-
"@tsed/cli-plugin-mongoose": cliVersion
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
name: "TypeORM",
|
|
286
|
-
value: {
|
|
287
|
-
type: "typeorm",
|
|
288
|
-
devDependencies: {
|
|
289
|
-
"@tsed/cli-plugin-typeorm": cliVersion
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
];
|
|
294
|
-
const featuresTestingChoices = (cliVersion) => [
|
|
295
|
-
{
|
|
296
|
-
name: "Jest",
|
|
297
|
-
value: {
|
|
298
|
-
type: "jest",
|
|
299
|
-
devDependencies: {
|
|
300
|
-
"@tsed/cli-plugin-jest": cliVersion
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
name: "Mocha + Chai + Sinon",
|
|
306
|
-
value: {
|
|
307
|
-
type: "mocha",
|
|
308
|
-
devDependencies: {
|
|
309
|
-
"@tsed/cli-plugin-mocha": cliVersion
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
];
|
|
314
|
-
const featuresLinterChoices = (cliVersion) => [
|
|
315
|
-
{
|
|
316
|
-
name: "EsLint",
|
|
317
|
-
checked: true,
|
|
318
|
-
value: {
|
|
319
|
-
type: "eslint",
|
|
320
|
-
devDependencies: {
|
|
321
|
-
"@tsed/cli-plugin-eslint": cliVersion
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
];
|
|
326
|
-
const featuresExtraLinterChoices = [
|
|
327
|
-
{
|
|
328
|
-
name: "Prettier",
|
|
329
|
-
value: {
|
|
330
|
-
type: "prettier"
|
|
331
|
-
}
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
name: "Lint on commit",
|
|
335
|
-
value: {
|
|
336
|
-
type: "lintstaged"
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
];
|
|
340
|
-
const featuresBundlerChoices = [
|
|
341
|
-
{
|
|
342
|
-
name: "Babel",
|
|
343
|
-
value: {
|
|
344
|
-
type: "babel",
|
|
345
|
-
devDependencies: {
|
|
346
|
-
...babelDevDependencies
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
name: "Webpack",
|
|
352
|
-
value: {
|
|
353
|
-
type: "babel:webpack",
|
|
354
|
-
devDependencies: {
|
|
355
|
-
...babelDevDependencies,
|
|
356
|
-
"babel-loader": "latest",
|
|
357
|
-
webpack: "latest",
|
|
358
|
-
"webpack-cli": "latest"
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
];
|
|
363
|
-
const packageManagerChoices = [
|
|
364
|
-
{
|
|
365
|
-
name: "Yarn",
|
|
366
|
-
checked: true,
|
|
367
|
-
value: "yarn"
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
name: "NPM",
|
|
371
|
-
checked: false,
|
|
372
|
-
value: "npm"
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
name: "PNPM - experimental",
|
|
376
|
-
checked: false,
|
|
377
|
-
value: "pnpm"
|
|
378
|
-
}
|
|
379
|
-
];
|
|
380
|
-
const parseFeaturesFile = (features, cliVersion) => {
|
|
381
|
-
return {
|
|
382
|
-
platform: features.platform,
|
|
383
|
-
convention: features.convention,
|
|
384
|
-
features: [
|
|
385
|
-
...featureChoices(cliVersion)
|
|
386
|
-
.map((v) => v.value)
|
|
387
|
-
.filter((v) => features.features.filter((v) => typeof v === "string").includes(v.type)),
|
|
388
|
-
...features.features.filter((v) => typeof v === "object")
|
|
389
|
-
],
|
|
390
|
-
featuresDB: featuresDbChoices(cliVersion).find((v) => v.value.type === features.featuresDB)?.value,
|
|
391
|
-
featuresTypeORM: exports.FEATURES_TYPEORM_CONNECTION_TYPES.find((v) => v.value.type === features.featuresTypeORM)?.value,
|
|
392
|
-
featuresTesting: featuresTestingChoices(cliVersion).find((v) => v.value.type === features.featuresTesting)?.value,
|
|
393
|
-
featuresLinter: featuresLinterChoices(cliVersion).find((v) => v.value.type === features.featuresLinter)?.value,
|
|
394
|
-
featuresExtraLinter: featuresExtraLinterChoices.map((v) => v.value).filter((v) => features.featuresExtraLinter?.includes(v.type)),
|
|
395
|
-
featuresBundler: featuresBundlerChoices.find((v) => v.value.type === features.featuresBundlerChoices)?.value,
|
|
396
|
-
packageManager: features.packageManager
|
|
397
|
-
};
|
|
398
|
-
};
|
|
399
|
-
exports.parseFeaturesFile = parseFeaturesFile;
|
|
400
|
-
const getFeaturesChoicesValues = (cliVersion) => {
|
|
401
|
-
return {
|
|
402
|
-
platform: platformChoices.map((v) => v.value),
|
|
403
|
-
convention: conventionChoices.map((v) => v.value),
|
|
404
|
-
features: featureChoices(cliVersion).map((v) => v.value.type),
|
|
405
|
-
featuresDB: featuresDbChoices(cliVersion).map((v) => v.value.type),
|
|
406
|
-
featuresTypeORM: exports.FEATURES_TYPEORM_CONNECTION_TYPES.map((v) => v.value.type),
|
|
407
|
-
featuresTesting: featuresTestingChoices(cliVersion).map((v) => v.value.type),
|
|
408
|
-
featuresLinter: featuresLinterChoices(cliVersion).map((v) => v.value.type),
|
|
409
|
-
featuresExtraLinter: featuresExtraLinterChoices.map((v) => v.value.type),
|
|
410
|
-
featuresBundler: featuresBundlerChoices.map((v) => v.value.type),
|
|
411
|
-
packageManager: packageManagerChoices.map((v) => v.value)
|
|
412
|
-
};
|
|
413
|
-
};
|
|
414
|
-
exports.getFeaturesChoicesValues = getFeaturesChoicesValues;
|
|
415
|
-
(0, cli_core_1.registerProvider)({
|
|
416
|
-
provide: Features,
|
|
417
|
-
deps: [cli_core_1.CliPackageJson],
|
|
418
|
-
useFactory(cliPackageJson) {
|
|
419
|
-
const cliVersion = cliPackageJson.version;
|
|
420
|
-
return [
|
|
421
|
-
{
|
|
422
|
-
message: "Choose the target platform:",
|
|
423
|
-
type: "list",
|
|
424
|
-
name: "platform",
|
|
425
|
-
choices: platformChoices
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
message: "Choose the architecture for your project:",
|
|
429
|
-
type: "list",
|
|
430
|
-
name: "architecture",
|
|
431
|
-
choices: [
|
|
432
|
-
{
|
|
433
|
-
name: "Ts.ED",
|
|
434
|
-
checked: true,
|
|
435
|
-
value: interfaces_1.ArchitectureConvention.DEFAULT
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
name: "feature",
|
|
439
|
-
checked: false,
|
|
440
|
-
value: interfaces_1.ArchitectureConvention.FEATURE
|
|
441
|
-
}
|
|
442
|
-
]
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
message: "Choose the convention file styling:",
|
|
446
|
-
type: "list",
|
|
447
|
-
name: "convention",
|
|
448
|
-
choices: conventionChoices
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
type: "checkbox",
|
|
452
|
-
name: "features",
|
|
453
|
-
message: "Check the features needed for your project",
|
|
454
|
-
choices: featureChoices(cliVersion)
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
message: "Choose a ORM manager",
|
|
458
|
-
type: "list",
|
|
459
|
-
name: "featuresDB",
|
|
460
|
-
when: hasFeature("db"),
|
|
461
|
-
choices: featuresDbChoices(cliVersion)
|
|
462
|
-
},
|
|
463
|
-
{
|
|
464
|
-
type: "list",
|
|
465
|
-
name: "featuresTypeORM",
|
|
466
|
-
message: "Which TypeORM you want to install?",
|
|
467
|
-
choices: exports.FEATURES_TYPEORM_CONNECTION_TYPES,
|
|
468
|
-
when: hasValue("featuresDB.type", "typeorm")
|
|
469
|
-
},
|
|
470
|
-
// {
|
|
471
|
-
// type: "password",
|
|
472
|
-
// name: "GH_TOKEN",
|
|
473
|
-
// message:
|
|
474
|
-
// "Enter GH_TOKEN to use the premium @tsedio/prisma package or leave blank (see https://tsed.io/tutorials/prisma-client.html)",
|
|
475
|
-
// when: hasValue("featuresDB.type", "prisma")
|
|
476
|
-
// },
|
|
477
|
-
{
|
|
478
|
-
message: "Choose unit framework",
|
|
479
|
-
type: "list",
|
|
480
|
-
name: "featuresTesting",
|
|
481
|
-
when: hasFeature("testing"),
|
|
482
|
-
choices: featuresTestingChoices(cliVersion)
|
|
483
|
-
},
|
|
484
|
-
{
|
|
485
|
-
message: "Choose linter tools framework",
|
|
486
|
-
type: "list",
|
|
487
|
-
name: "featuresLinter",
|
|
488
|
-
when: hasFeature("linter"),
|
|
489
|
-
choices: featuresLinterChoices(cliVersion)
|
|
490
|
-
},
|
|
491
|
-
{
|
|
492
|
-
message: "Choose extra linter tools",
|
|
493
|
-
type: "checkbox",
|
|
494
|
-
name: "featuresExtraLinter",
|
|
495
|
-
when: hasFeature("linter"),
|
|
496
|
-
choices: featuresExtraLinterChoices
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
message: "Choose your bundler",
|
|
500
|
-
type: "list",
|
|
501
|
-
name: "featuresBundler",
|
|
502
|
-
when: hasFeature("bundler"),
|
|
503
|
-
choices: featuresBundlerChoices
|
|
504
|
-
},
|
|
505
|
-
{
|
|
506
|
-
message: "Choose the OIDC base path server",
|
|
507
|
-
name: "oidcBasePath",
|
|
508
|
-
default: "/oidc",
|
|
509
|
-
when: hasFeature("oidc"),
|
|
510
|
-
type: "input"
|
|
511
|
-
},
|
|
512
|
-
{
|
|
513
|
-
message: "Choose the OIDC base path server",
|
|
514
|
-
name: "oidcBasePath",
|
|
515
|
-
default: "/oidc",
|
|
516
|
-
when: hasFeature("oidc"),
|
|
517
|
-
type: "input"
|
|
518
|
-
},
|
|
519
|
-
{
|
|
520
|
-
message: "Choose the package manager:",
|
|
521
|
-
type: "list",
|
|
522
|
-
name: "packageManager",
|
|
523
|
-
choices: packageManagerChoices
|
|
524
|
-
}
|
|
525
|
-
];
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
//# sourceMappingURL=Features.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Features.js","sourceRoot":"","sources":["../../../src/services/Features.ts"],"names":[],"mappings":";;;AAAA,6CAAwE;AACxE,qCAAoC;AACpC,8CAAwE;AAexE,SAAgB,QAAQ;IACtB,OAAO,IAAA,iBAAM,EAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAFD,4BAEC;AAED,SAAgB,UAAU,CAAC,OAAe;IACxC,OAAO,CAAC,GAAQ,EAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;AAC1F,CAAC;AAFD,gCAEC;AAED,SAAgB,QAAQ,CAAC,UAAkB,EAAE,KAAU;IACrD,OAAO,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAA,eAAQ,EAAC,UAAU,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC;AAC3D,CAAC;AAFD,4BAEC;AAED,SAAgB,UAAU,CAAC,GAAG,KAAe;IAC3C,OAAO,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,C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,gBAAgB;gBACtB,OAAO,EAAE,qBAAqB;aAC/B;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {CliPackageJson, Inject, registerProvider} from \"@tsed/cli-core\";\nimport {getValue} from \"@tsed/core\";\nimport {ProjectConvention, ArchitectureConvention} from \"../interfaces\";\n\nexport interface FeatureValue {\n type: string;\n dependencies?: {[key: string]: string | undefined};\n devDependencies?: {[key: string]: string | undefined};\n}\n\nexport interface Feature {\n name: string;\n value: FeatureValue;\n}\n\nexport type Features = Feature[];\n\nexport function Features() {\n return Inject(Features);\n}\n\nexport function hasFeature(feature: string) {\n return (ctx: any): boolean => !!ctx.features.find((item: any) => item.type === feature);\n}\n\nexport function hasValue(expression: string, value: any) {\n return (ctx: any) => getValue(expression, ctx) === value;\n}\n\nexport function isPlatform(...types: string[]) {\n return (ctx: any) => [types].includes(ctx.platform);\n}\n\nexport const FEATURES_TYPEORM_CONNECTION_TYPES = [\n {\n name: \"MySQL\",\n value: {\n type: \"typeorm:mysql\",\n dependencies: {\n mysql2: \"latest\"\n }\n }\n },\n {\n name: \"MariaDB\",\n value: {\n type: \"typeorm:mariadb\",\n dependencies: {\n mariadb: \"latest\"\n }\n }\n },\n {\n name: \"Postgres\",\n value: {\n type: \"typeorm:postgres\",\n dependencies: {\n pg: \"latest\"\n }\n }\n },\n {\n name: \"CockRoachDB\",\n value: {\n type: \"typeorm:postgres\",\n dependencies: {\n cockroachdb: \"latest\"\n }\n }\n },\n {\n name: \"SQLite\",\n value: {\n type: \"typeorm:sqlite\",\n dependencies: {\n sqlite3: \"latest\"\n }\n }\n },\n {\n name: \"Better SQLite3\",\n value: {\n type: \"typeorm:better-sqlite3\",\n dependencies: {\n \"better-sqlite3\": \"latest\"\n }\n }\n },\n {\n name: \"Cordova\",\n value: {\n type: \"typeorm:cordova\"\n }\n },\n {\n name: \"NativeScript\",\n value: {\n type: \"typeorm:nativescript\"\n }\n },\n {\n name: \"Oracle\",\n value: {\n type: \"typeorm:oracle\",\n dependencies: {\n oracledb: \"latest\"\n }\n }\n },\n {\n name: \"MsSQL\",\n value: {\n type: \"typeorm:mssql\",\n dependencies: {\n mssql: \"latest\"\n }\n }\n },\n {\n name: \"MongoDB\",\n value: {\n type: \"typeorm:mongodb\",\n dependencies: {\n mongodb: \"latest\"\n }\n }\n },\n {\n name: \"SQL.js\",\n value: {\n type: \"typeorm:sqljs\",\n dependencies: {}\n }\n },\n {\n name: \"ReactNative\",\n value: {\n type: \"typeorm:reactnative\",\n dependencies: {}\n }\n },\n {\n name: \"Expo\",\n value: {\n type: \"typeorm:expo\",\n dependencies: {}\n }\n }\n];\n\nconst babelDevDependencies = {\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\nconst platformChoices = [\n {\n name: \"Express.js\",\n checked: true,\n value: \"express\"\n },\n {\n name: \"Koa.js\",\n checked: false,\n value: \"koa\"\n }\n];\n\nconst conventionChoices = [\n {\n name: \"Ts.ED\",\n checked: true,\n value: ProjectConvention.DEFAULT\n },\n {\n name: \"Angular\",\n checked: false,\n value: ProjectConvention.ANGULAR\n }\n];\n\nconst featureChoices = (cliVersion: string) => [\n {\n name: \"TypeGraphQL\",\n value: {\n type: \"graphql\",\n dependencies: {\n \"@tsed/typegraphql\": \"{{tsedVersion}}\"\n },\n devDependencies: {\n \"@tsed/cli-plugin-typegraphql\": cliVersion\n }\n }\n },\n {\n name: \"Database\",\n value: {type: \"db\"}\n },\n {\n name: \"Passport.js\",\n when: isPlatform(\"express\"),\n value: {\n type: \"passportjs\",\n devDependencies: {\n \"@tsed/cli-plugin-passport\": cliVersion\n }\n }\n },\n {\n name: \"Socket.io\",\n value: {\n type: \"socketio\",\n dependencies: {\n \"@tsed/socketio\": \"{{tsedVersion}}\",\n \"socket.io\": \"latest\"\n }\n }\n },\n {\n name: \"Swagger\",\n value: {\n type: \"swagger\",\n dependencies: {\n \"@tsed/swagger\": \"{{tsedVersion}}\"\n }\n }\n },\n {\n name: \"OpenID Connect provider\",\n value: {\n type: \"oidc\",\n devDependencies: {\n \"@tsed/cli-plugin-oidc-provider\": cliVersion\n }\n }\n },\n {\n name: \"Testing\",\n value: {\n type: \"testing\",\n dependencies: {},\n devDependencies: {\n \"@types/supertest\": \"latest\",\n supertest: \"latest\"\n }\n }\n },\n {\n name: \"Linter\",\n value: {\n type: \"linter\"\n }\n },\n {\n name: \"Bundler\",\n value: {\n type: \"bundler\"\n }\n },\n {\n name: \"Commands\",\n value: {\n type: \"commands\",\n dependencies: {\n \"@tsed/cli-core\": cliVersion\n },\n devDependencies: {\n \"@types/inquirer\": \"latest\"\n }\n }\n }\n];\n\nconst featuresDbChoices = (cliVersion: string) => [\n {\n name: \"Prisma\",\n value: {\n type: \"prisma\",\n devDependencies: {\n \"@tsed/cli-plugin-prisma\": cliVersion\n }\n }\n },\n {\n name: \"Mongoose\",\n value: {\n type: \"mongoose\",\n devDependencies: {\n \"@tsed/cli-plugin-mongoose\": cliVersion\n }\n }\n },\n {\n name: \"TypeORM\",\n value: {\n type: \"typeorm\",\n devDependencies: {\n \"@tsed/cli-plugin-typeorm\": cliVersion\n }\n }\n }\n];\n\nconst featuresTestingChoices = (cliVersion: string) => [\n {\n name: \"Jest\",\n value: {\n type: \"jest\",\n devDependencies: {\n \"@tsed/cli-plugin-jest\": cliVersion\n }\n }\n },\n {\n name: \"Mocha + Chai + Sinon\",\n value: {\n type: \"mocha\",\n devDependencies: {\n \"@tsed/cli-plugin-mocha\": cliVersion\n }\n }\n }\n];\n\nconst featuresLinterChoices = (cliVersion: string) => [\n {\n name: \"EsLint\",\n checked: true,\n value: {\n type: \"eslint\",\n devDependencies: {\n \"@tsed/cli-plugin-eslint\": cliVersion\n }\n }\n }\n];\n\nconst featuresExtraLinterChoices = [\n {\n name: \"Prettier\",\n value: {\n type: \"prettier\"\n }\n },\n {\n name: \"Lint on commit\",\n value: {\n type: \"lintstaged\"\n }\n }\n];\n\nconst featuresBundlerChoices = [\n {\n name: \"Babel\",\n value: {\n type: \"babel\",\n devDependencies: {\n ...babelDevDependencies\n }\n }\n },\n {\n name: \"Webpack\",\n value: {\n type: \"babel:webpack\",\n devDependencies: {\n ...babelDevDependencies,\n \"babel-loader\": \"latest\",\n webpack: \"latest\",\n \"webpack-cli\": \"latest\"\n }\n }\n }\n];\n\nconst packageManagerChoices = [\n {\n name: \"Yarn\",\n checked: true,\n value: \"yarn\"\n },\n {\n name: \"NPM\",\n checked: false,\n value: \"npm\"\n },\n {\n name: \"PNPM - experimental\",\n checked: false,\n value: \"pnpm\"\n }\n];\n\nexport const parseFeaturesFile = (features: Record<string, any>, cliVersion: string) => {\n return {\n platform: features.platform,\n convention: features.convention,\n features: [\n ...featureChoices(cliVersion)\n .map((v) => v.value)\n .filter((v) => features.features.filter((v: string | Record<string, any>) => typeof v === \"string\").includes(v.type)),\n ...features.features.filter((v: string | Record<string, any>) => typeof v === \"object\")\n ],\n featuresDB: featuresDbChoices(cliVersion).find((v) => v.value.type === features.featuresDB)?.value,\n featuresTypeORM: FEATURES_TYPEORM_CONNECTION_TYPES.find((v) => v.value.type === features.featuresTypeORM)?.value,\n featuresTesting: featuresTestingChoices(cliVersion).find((v) => v.value.type === features.featuresTesting)?.value,\n featuresLinter: featuresLinterChoices(cliVersion).find((v) => v.value.type === features.featuresLinter)?.value,\n featuresExtraLinter: featuresExtraLinterChoices.map((v) => v.value).filter((v) => features.featuresExtraLinter?.includes(v.type)),\n featuresBundler: featuresBundlerChoices.find((v) => v.value.type === features.featuresBundlerChoices)?.value,\n packageManager: features.packageManager\n };\n};\n\nexport const getFeaturesChoicesValues = (cliVersion: string) => {\n return {\n platform: platformChoices.map((v) => v.value),\n convention: conventionChoices.map((v) => v.value),\n features: featureChoices(cliVersion).map((v) => v.value.type),\n featuresDB: featuresDbChoices(cliVersion).map((v) => v.value.type),\n featuresTypeORM: FEATURES_TYPEORM_CONNECTION_TYPES.map((v) => v.value.type),\n featuresTesting: featuresTestingChoices(cliVersion).map((v) => v.value.type),\n featuresLinter: featuresLinterChoices(cliVersion).map((v) => v.value.type),\n featuresExtraLinter: featuresExtraLinterChoices.map((v) => v.value.type),\n featuresBundler: featuresBundlerChoices.map((v) => v.value.type),\n packageManager: packageManagerChoices.map((v) => v.value)\n };\n};\n\nregisterProvider({\n provide: Features,\n deps: [CliPackageJson],\n useFactory(cliPackageJson: CliPackageJson) {\n const cliVersion = cliPackageJson.version;\n\n return [\n {\n message: \"Choose the target platform:\",\n type: \"list\",\n name: \"platform\",\n choices: platformChoices\n },\n {\n message: \"Choose the architecture for your project:\",\n type: \"list\",\n name: \"architecture\",\n choices: [\n {\n name: \"Ts.ED\",\n checked: true,\n value: ArchitectureConvention.DEFAULT\n },\n {\n name: \"feature\",\n checked: false,\n value: ArchitectureConvention.FEATURE\n }\n ]\n },\n {\n message: \"Choose the convention file styling:\",\n type: \"list\",\n name: \"convention\",\n choices: conventionChoices\n },\n {\n type: \"checkbox\",\n name: \"features\",\n message: \"Check the features needed for your project\",\n choices: featureChoices(cliVersion)\n },\n {\n message: \"Choose a ORM manager\",\n type: \"list\",\n name: \"featuresDB\",\n when: hasFeature(\"db\"),\n choices: featuresDbChoices(cliVersion)\n },\n {\n type: \"list\",\n name: \"featuresTypeORM\",\n message: \"Which TypeORM you want to install?\",\n choices: FEATURES_TYPEORM_CONNECTION_TYPES,\n when: hasValue(\"featuresDB.type\", \"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(\"testing\"),\n choices: featuresTestingChoices(cliVersion)\n },\n {\n message: \"Choose linter tools framework\",\n type: \"list\",\n name: \"featuresLinter\",\n when: hasFeature(\"linter\"),\n choices: featuresLinterChoices(cliVersion)\n },\n {\n message: \"Choose extra linter tools\",\n type: \"checkbox\",\n name: \"featuresExtraLinter\",\n when: hasFeature(\"linter\"),\n choices: featuresExtraLinterChoices\n },\n {\n message: \"Choose your bundler\",\n type: \"list\",\n name: \"featuresBundler\",\n when: hasFeature(\"bundler\"),\n choices: featuresBundlerChoices\n },\n {\n message: \"Choose the OIDC base path server\",\n name: \"oidcBasePath\",\n default: \"/oidc\",\n when: hasFeature(\"oidc\"),\n type: \"input\"\n },\n {\n message: \"Choose the OIDC base path server\",\n name: \"oidcBasePath\",\n default: \"/oidc\",\n when: hasFeature(\"oidc\"),\n type: \"input\"\n },\n {\n message: \"Choose the package manager:\",\n type: \"list\",\n name: \"packageManager\",\n choices: packageManagerChoices\n }\n ];\n }\n});\n"]}
|