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