@tsed/cli 3.24.0 → 3.26.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/lib/cjs/Cli.js +35 -4
  2. package/lib/cjs/Cli.js.map +1 -1
  3. package/lib/cjs/bin/tsed.js +1 -23
  4. package/lib/cjs/bin/tsed.js.map +1 -1
  5. package/lib/cjs/commands/init/InitCmd.js +58 -34
  6. package/lib/cjs/commands/init/InitCmd.js.map +1 -1
  7. package/lib/cjs/commands/init/config/FeaturesPrompt.js +406 -0
  8. package/lib/cjs/commands/init/config/FeaturesPrompt.js.map +1 -0
  9. package/lib/cjs/commands/init/config/InitFileSchema.js +49 -0
  10. package/lib/cjs/commands/init/config/InitFileSchema.js.map +1 -0
  11. package/lib/cjs/commands/init/interfaces/InitCmdContext.js +3 -0
  12. package/lib/cjs/commands/init/interfaces/InitCmdContext.js.map +1 -0
  13. package/lib/cjs/commands/init/interfaces/InitOptions.js +3 -0
  14. package/lib/cjs/commands/init/interfaces/InitOptions.js.map +1 -0
  15. package/lib/cjs/commands/init/interfaces/InitPromptAnswers.js +3 -0
  16. package/lib/cjs/commands/init/interfaces/InitPromptAnswers.js.map +1 -0
  17. package/lib/cjs/commands/init/mappers/mapToContext.js +16 -0
  18. package/lib/cjs/commands/init/mappers/mapToContext.js.map +1 -0
  19. package/lib/cjs/commands/init/mappers/mapUniqFeatures.js +18 -0
  20. package/lib/cjs/commands/init/mappers/mapUniqFeatures.js.map +1 -0
  21. package/lib/cjs/commands/init/prompts/getFeaturesPrompt.js +25 -0
  22. package/lib/cjs/commands/init/prompts/getFeaturesPrompt.js.map +1 -0
  23. package/lib/cjs/commands/init/utils/hasFeature.js +13 -0
  24. package/lib/cjs/commands/init/utils/hasFeature.js.map +1 -0
  25. package/lib/cjs/commands/init/utils/isPlatform.js +8 -0
  26. package/lib/cjs/commands/init/utils/isPlatform.js.map +1 -0
  27. package/lib/cjs/index.js +6 -1
  28. package/lib/cjs/index.js.map +1 -1
  29. package/lib/cjs/interfaces/PlatformType.js +9 -0
  30. package/lib/cjs/interfaces/PlatformType.js.map +1 -0
  31. package/lib/cjs/interfaces/index.js +1 -0
  32. package/lib/cjs/interfaces/index.js.map +1 -1
  33. package/lib/cjs/services/Features.js +118 -133
  34. package/lib/cjs/services/Features.js.map +1 -1
  35. package/lib/esm/Cli.js +35 -4
  36. package/lib/esm/Cli.js.map +1 -1
  37. package/lib/esm/bin/tsed.js +1 -22
  38. package/lib/esm/bin/tsed.js.map +1 -1
  39. package/lib/esm/commands/init/InitCmd.js +61 -37
  40. package/lib/esm/commands/init/InitCmd.js.map +1 -1
  41. package/lib/esm/commands/init/config/FeaturesPrompt.js +402 -0
  42. package/lib/esm/commands/init/config/FeaturesPrompt.js.map +1 -0
  43. package/lib/esm/commands/init/config/InitFileSchema.js +46 -0
  44. package/lib/esm/commands/init/config/InitFileSchema.js.map +1 -0
  45. package/lib/esm/commands/init/interfaces/InitCmdContext.js +2 -0
  46. package/lib/esm/commands/init/interfaces/InitCmdContext.js.map +1 -0
  47. package/lib/esm/commands/init/interfaces/InitOptions.js +2 -0
  48. package/lib/esm/commands/init/interfaces/InitOptions.js.map +1 -0
  49. package/lib/esm/commands/init/interfaces/InitPromptAnswers.js +2 -0
  50. package/lib/esm/commands/init/interfaces/InitPromptAnswers.js.map +1 -0
  51. package/lib/esm/commands/init/mappers/mapToContext.js +12 -0
  52. package/lib/esm/commands/init/mappers/mapToContext.js.map +1 -0
  53. package/lib/esm/commands/init/mappers/mapUniqFeatures.js +14 -0
  54. package/lib/esm/commands/init/mappers/mapUniqFeatures.js.map +1 -0
  55. package/lib/esm/commands/init/prompts/getFeaturesPrompt.js +21 -0
  56. package/lib/esm/commands/init/prompts/getFeaturesPrompt.js.map +1 -0
  57. package/lib/esm/commands/init/utils/hasFeature.js +8 -0
  58. package/lib/esm/commands/init/utils/hasFeature.js.map +1 -0
  59. package/lib/esm/commands/init/utils/isPlatform.js +4 -0
  60. package/lib/esm/commands/init/utils/isPlatform.js.map +1 -0
  61. package/lib/esm/index.js +6 -1
  62. package/lib/esm/index.js.map +1 -1
  63. package/lib/esm/interfaces/PlatformType.js +6 -0
  64. package/lib/esm/interfaces/PlatformType.js.map +1 -0
  65. package/lib/esm/interfaces/index.js +1 -0
  66. package/lib/esm/interfaces/index.js.map +1 -1
  67. package/lib/esm/services/Features.js +117 -128
  68. package/lib/esm/services/Features.js.map +1 -1
  69. package/lib/types/Cli.d.ts +23 -1
  70. package/lib/types/commands/index.d.ts +1 -1
  71. package/lib/types/commands/init/InitCmd.d.ts +8 -24
  72. package/lib/types/commands/init/config/FeaturesPrompt.d.ts +98 -0
  73. package/lib/types/commands/init/config/InitFileSchema.d.ts +45 -0
  74. package/lib/types/commands/init/interfaces/InitCmdContext.d.ts +6 -0
  75. package/lib/types/commands/init/interfaces/InitOptions.d.ts +19 -0
  76. package/lib/types/commands/init/interfaces/InitPromptAnswers.d.ts +16 -0
  77. package/lib/types/commands/init/mappers/mapToContext.d.ts +2 -0
  78. package/lib/types/commands/init/mappers/mapUniqFeatures.d.ts +3 -0
  79. package/lib/types/commands/init/prompts/getFeaturesPrompt.d.ts +2 -0
  80. package/lib/types/commands/init/utils/hasFeature.d.ts +2 -0
  81. package/lib/types/commands/init/utils/isPlatform.d.ts +1 -0
  82. package/lib/types/index.d.ts +6 -1
  83. package/lib/types/interfaces/PlatformType.d.ts +4 -0
  84. package/lib/types/interfaces/index.d.ts +1 -0
  85. package/lib/types/services/Features.d.ts +0 -18
  86. package/package.json +7 -4
  87. package/readme.md +33 -8
  88. package/templates/init/tsconfig.json.hbs +3 -5
package/lib/cjs/index.js CHANGED
@@ -3,11 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./commands/add/AddCmd"), exports);
5
5
  tslib_1.__exportStar(require("./commands/init/InitCmd"), exports);
6
+ tslib_1.__exportStar(require("./commands/init/interfaces/InitCmdContext"), exports);
7
+ tslib_1.__exportStar(require("./commands/init/interfaces/InitOptions"), exports);
8
+ tslib_1.__exportStar(require("./commands/init/config/FeaturesPrompt"), exports);
9
+ tslib_1.__exportStar(require("./commands/init/config/FeaturesPrompt"), exports);
6
10
  tslib_1.__exportStar(require("./commands/generate/GenerateCmd"), exports);
7
11
  tslib_1.__exportStar(require("./commands/update/UpdateCmd"), exports);
12
+ tslib_1.__exportStar(require("./commands/init/prompts/getFeaturesPrompt"), exports);
8
13
  tslib_1.__exportStar(require("./interfaces"), exports);
9
14
  tslib_1.__exportStar(require("./services/ProvidersInfoService"), exports);
10
- tslib_1.__exportStar(require("./services/Features"), exports);
11
15
  tslib_1.__exportStar(require("./pipes"), exports);
12
16
  tslib_1.__exportStar(require("./constants"), exports);
17
+ tslib_1.__exportStar(require("./Cli"), exports);
13
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,kEAAwC;AACxC,0EAAgD;AAChD,sEAA4C;AAC5C,uDAA6B;AAC7B,0EAAgD;AAChD,8DAAoC;AACpC,kDAAwB;AACxB,sDAA4B","sourcesContent":["export * from \"./commands/add/AddCmd\";\nexport * from \"./commands/init/InitCmd\";\nexport * from \"./commands/generate/GenerateCmd\";\nexport * from \"./commands/update/UpdateCmd\";\nexport * from \"./interfaces\";\nexport * from \"./services/ProvidersInfoService\";\nexport * from \"./services/Features\";\nexport * from \"./pipes\";\nexport * from \"./constants\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,kEAAwC;AACxC,oFAA0D;AAC1D,iFAAuD;AACvD,gFAAsD;AACtD,gFAAsD;AACtD,0EAAgD;AAChD,sEAA4C;AAC5C,oFAA0D;AAC1D,uDAA6B;AAC7B,0EAAgD;AAChD,kDAAwB;AACxB,sDAA4B;AAC5B,gDAAsB","sourcesContent":["export * from \"./commands/add/AddCmd\";\nexport * from \"./commands/init/InitCmd\";\nexport * from \"./commands/init/interfaces/InitCmdContext\";\nexport * from \"./commands/init/interfaces/InitOptions\";\nexport * from \"./commands/init/config/FeaturesPrompt\";\nexport * from \"./commands/init/config/FeaturesPrompt\";\nexport * from \"./commands/generate/GenerateCmd\";\nexport * from \"./commands/update/UpdateCmd\";\nexport * from \"./commands/init/prompts/getFeaturesPrompt\";\nexport * from \"./interfaces\";\nexport * from \"./services/ProvidersInfoService\";\nexport * from \"./pipes\";\nexport * from \"./constants\";\nexport * from \"./Cli\";\n"]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlatformType = void 0;
4
+ var PlatformType;
5
+ (function (PlatformType) {
6
+ PlatformType["EXPRESS"] = "express";
7
+ PlatformType["KOA"] = "koa";
8
+ })(PlatformType = exports.PlatformType || (exports.PlatformType = {}));
9
+ //# sourceMappingURL=PlatformType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlatformType.js","sourceRoot":"","sources":["../../../src/interfaces/PlatformType.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,2BAAW,CAAA;AACb,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB","sourcesContent":["export enum PlatformType {\n EXPRESS = \"express\",\n KOA = \"koa\"\n}\n"]}
@@ -2,5 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./ProjectConvention"), exports);
5
+ tslib_1.__exportStar(require("./PlatformType"), exports);
5
6
  tslib_1.__exportStar(require("./ArchitectureConvention"), exports);
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC;AACpC,mEAAyC","sourcesContent":["export * from \"./ProjectConvention\";\nexport * from \"./ArchitectureConvention\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC;AACpC,yDAA+B;AAC/B,mEAAyC","sourcesContent":["export * from \"./ProjectConvention\";\nexport * from \"./PlatformType\";\nexport * from \"./ArchitectureConvention\";\n"]}
@@ -1,25 +1,8 @@
1
1
  "use strict";
2
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");
3
+ exports.getFeaturesChoicesValues = exports.parseFeaturesFile = exports.FEATURES_TYPEORM_CONNECTION_TYPES = void 0;
6
4
  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;
5
+ const isPlatform_1 = require("../commands/init/utils/isPlatform");
23
6
  exports.FEATURES_TYPEORM_CONNECTION_TYPES = [
24
7
  {
25
8
  name: "MySQL",
@@ -190,7 +173,7 @@ const featureChoices = (cliVersion) => [
190
173
  },
191
174
  {
192
175
  name: "Passport.js",
193
- when: isPlatform("express"),
176
+ when: (0, isPlatform_1.isPlatform)("express"),
194
177
  value: {
195
178
  type: "passportjs",
196
179
  devDependencies: {
@@ -412,117 +395,119 @@ const getFeaturesChoicesValues = (cliVersion) => {
412
395
  };
413
396
  };
414
397
  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
- });
398
+ //
399
+ // registerProvider({
400
+ // provide: Features,
401
+ // deps: [CliPackageJson],
402
+ // useFactory(cliPackageJson: CliPackageJson) {
403
+ // const cliVersion = cliPackageJson.version;
404
+ //
405
+ // return [
406
+ // {
407
+ // message: "Choose the target platform:",
408
+ // type: "list",
409
+ // name: "platform",
410
+ // choices: platformChoices
411
+ // },
412
+ // {
413
+ // message: "Choose the architecture for your project:",
414
+ // type: "list",
415
+ // name: "architecture",
416
+ // choices: [
417
+ // {
418
+ // name: "Ts.ED",
419
+ // checked: true,
420
+ // value: ArchitectureConvention.DEFAULT
421
+ // },
422
+ // {
423
+ // name: "feature",
424
+ // checked: false,
425
+ // value: ArchitectureConvention.FEATURE
426
+ // }
427
+ // ]
428
+ // },
429
+ // {
430
+ // message: "Choose the convention file styling:",
431
+ // type: "list",
432
+ // name: "convention",
433
+ // choices: conventionChoices
434
+ // },
435
+ // {
436
+ // type: "checkbox",
437
+ // name: "features",
438
+ // message: "Check the features needed for your project",
439
+ // choices: featureChoices(cliVersion)
440
+ // },
441
+ // {
442
+ // message: "Choose a ORM manager",
443
+ // type: "list",
444
+ // name: "featuresDB",
445
+ // when: hasFeature("db"),
446
+ // choices: featuresDbChoices(cliVersion)
447
+ // },
448
+ // {
449
+ // type: "list",
450
+ // name: "featuresTypeORM",
451
+ // message: "Which TypeORM you want to install?",
452
+ // choices: FEATURES_TYPEORM_CONNECTION_TYPES,
453
+ // when: hasValue("featuresDB.type", "typeorm")
454
+ // },
455
+ // // {
456
+ // // type: "password",
457
+ // // name: "GH_TOKEN",
458
+ // // message:
459
+ // // "Enter GH_TOKEN to use the premium @tsedio/prisma package or leave blank (see https://tsed.io/tutorials/prisma-client.html)",
460
+ // // when: hasValue("featuresDB.type", "prisma")
461
+ // // },
462
+ // {
463
+ // message: "Choose unit framework",
464
+ // type: "list",
465
+ // name: "featuresTesting",
466
+ // when: hasFeature("testing"),
467
+ // choices: featuresTestingChoices(cliVersion)
468
+ // },
469
+ // {
470
+ // message: "Choose linter tools framework",
471
+ // type: "list",
472
+ // name: "featuresLinter",
473
+ // when: hasFeature("linter"),
474
+ // choices: featuresLinterChoices(cliVersion)
475
+ // },
476
+ // {
477
+ // message: "Choose extra linter tools",
478
+ // type: "checkbox",
479
+ // name: "featuresExtraLinter",
480
+ // when: hasFeature("linter"),
481
+ // choices: featuresExtraLinterChoices
482
+ // },
483
+ // {
484
+ // message: "Choose your bundler",
485
+ // type: "list",
486
+ // name: "featuresBundler",
487
+ // when: hasFeature("bundler"),
488
+ // choices: featuresBundlerChoices
489
+ // },
490
+ // {
491
+ // message: "Choose the OIDC base path server",
492
+ // name: "oidcBasePath",
493
+ // default: "/oidc",
494
+ // when: hasFeature("oidc"),
495
+ // type: "input"
496
+ // },
497
+ // {
498
+ // message: "Choose the OIDC base path server",
499
+ // name: "oidcBasePath",
500
+ // default: "/oidc",
501
+ // when: hasFeature("oidc"),
502
+ // type: "input"
503
+ // },
504
+ // {
505
+ // message: "Choose the package manager:",
506
+ // type: "list",
507
+ // name: "packageManager",
508
+ // choices: packageManagerChoices
509
+ // }
510
+ // ];
511
+ // }
512
+ // });
528
513
  //# sourceMappingURL=Features.js.map
@@ -1 +1 @@
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,CAAC;AACtD,CAAC;AAFD,gCAEC;AAEY,QAAA,iCAAiC,GAAG;IAC/C;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,IAAI,EAAE,eAAe;YACrB,YAAY,EAAE;gBACZ,MAAM,EAAE,QAAQ;aACjB;SACF;KACF;IACD;QACE,IAAI,EAAE,SAAS;QACf,KAAK,EAAE;YACL,IAAI,EAAE,iBAAiB;YACvB,YAAY,EAAE;gBACZ,OAAO,EAAE,QAAQ;aAClB;SACF;KACF;IACD;QACE,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE;YACL,IAAI,EAAE,kBAAkB;YACxB,YAAY,EAAE;gBACZ,EAAE,EAAE,QAAQ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,EAAE,UAAU,CAAC,QAAQ,CAAC;gBAC1B,OAAO,EAAE,qBAAqB,CAAC,UAAU,CAAC;aAC3C;YACD;gBACE,OAAO,EAAE,2BAA2B;gBACpC,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,qBAAqB;gBAC3B,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC;gBAC1B,OAAO,EAAE,0BAA0B;aACpC;YACD;gBACE,OAAO,EAAE,qBAAqB;gBAC9B,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC;gBAC3B,OAAO,EAAE,sBAAsB;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"]}
1
+ {"version":3,"file":"Features.js","sourceRoot":"","sources":["../../../src/services/Features.ts"],"names":[],"mappings":";;;AAAA,8CAAgD;AAChD,kEAA6D;AAEhD,QAAA,iCAAiC,GAAG;IAC/C;QACE,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,IAAI,EAAE,eAAe;YACrB,YAAY,EAAE;gBACZ,MAAM,EAAE,QAAQ;aACjB;SACF;KACF;IACD;QACE,IAAI,EAAE,SAAS;QACf,KAAK,EAAE;YACL,IAAI,EAAE,iBAAiB;YACvB,YAAY,EAAE;gBACZ,OAAO,EAAE,QAAQ;aAClB;SACF;KACF;IACD;QACE,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE;YACL,IAAI,EAAE,kBAAkB;YACxB,YAAY,EAAE;gBACZ,EAAE,EAAE,QAAQ;aACb;SACF;KACF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE;YACL,IAAI,EAAE,kBAAkB;YACxB,YAAY,EAAE;gBACZ,WAAW,EAAE,QAAQ;aACtB;SACF;KACF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE;YACL,IAAI,EAAE,gBAAgB;YACtB,YAAY,EAAE;gBACZ,OAAO,EAAE,QAAQ;aAClB;SACF;KACF;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE;YACL,IAAI,EAAE,wBAAwB;YAC9B,YAAY,EAAE;gBACZ,gBAAgB,EAAE,QAAQ;aAC3B;SACF;KACF;IACD;QACE,IAAI,EAAE,SAAS;QACf,KAAK,EAAE;YACL,IAAI,EAAE,iBAAiB;SACxB;KACF;IACD;QACE,IAAI,EAAE,cA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cAAc;AACd,UAAU;AACV,4CAA4C;AAC5C,wBAAwB;AACxB,mCAAmC;AACnC,uCAAuC;AACvC,sDAAsD;AACtD,WAAW;AACX,UAAU;AACV,oDAAoD;AACpD,wBAAwB;AACxB,kCAAkC;AAClC,sCAAsC;AACtC,qDAAqD;AACrD,WAAW;AACX,UAAU;AACV,gDAAgD;AAChD,4BAA4B;AAC5B,uCAAuC;AACvC,sCAAsC;AACtC,8CAA8C;AAC9C,WAAW;AACX,UAAU;AACV,0CAA0C;AAC1C,wBAAwB;AACxB,mCAAmC;AACnC,uCAAuC;AACvC,0CAA0C;AAC1C,WAAW;AACX,UAAU;AACV,uDAAuD;AACvD,gCAAgC;AAChC,4BAA4B;AAC5B,oCAAoC;AACpC,wBAAwB;AACxB,WAAW;AACX,UAAU;AACV,uDAAuD;AACvD,gCAAgC;AAChC,4BAA4B;AAC5B,oCAAoC;AACpC,wBAAwB;AACxB,WAAW;AACX,UAAU;AACV,kDAAkD;AAClD,wBAAwB;AACxB,kCAAkC;AAClC,yCAAyC;AACzC,UAAU;AACV,SAAS;AACT,MAAM;AACN,MAAM","sourcesContent":["import {ProjectConvention} from \"../interfaces\";\nimport {isPlatform} from \"../commands/init/utils/isPlatform\";\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//\n// registerProvider({\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"]}
package/lib/esm/Cli.js CHANGED
@@ -3,7 +3,29 @@ import chalk from "chalk";
3
3
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
4
  // @ts-ignore
5
5
  import alias from "module-alias";
6
+ import { PKG, TEMPLATE_DIR } from "./constants.js";
7
+ import commands from "./commands.js";
8
+ import { ArchitectureConvention, ProjectConvention } from "./interfaces.js";
6
9
  export class Cli extends CliCore {
10
+ static defaults = {
11
+ name: "tsed",
12
+ pkg: PKG,
13
+ templateDir: TEMPLATE_DIR,
14
+ plugins: true,
15
+ commands,
16
+ defaultProjectPreferences() {
17
+ return {
18
+ convention: ProjectConvention.DEFAULT,
19
+ architecture: ArchitectureConvention.DEFAULT
20
+ };
21
+ },
22
+ project: {
23
+ reinstallAfterRun: true
24
+ },
25
+ logger: {
26
+ level: "info"
27
+ }
28
+ };
7
29
  static checkPackage(pkg) {
8
30
  if (!pkg) {
9
31
  console.log(chalk.red(`settings.pkg is required. Require the package.json of your CLI when you bootstrap the CLI.`));
@@ -24,12 +46,21 @@ export class Cli extends CliCore {
24
46
  this.checkNodeVersion(pkg.engines.node, pkg.name);
25
47
  }
26
48
  }
27
- static async bootstrap(settings) {
28
- const { pkg } = settings;
29
- this.checkPrecondition(settings);
49
+ static async bootstrap(settings = {}) {
50
+ const opts = {
51
+ ...Cli.defaults,
52
+ ...settings
53
+ };
54
+ const { pkg } = opts;
55
+ this.checkPrecondition(opts);
30
56
  this.createAliases();
31
57
  this.updateNotifier(pkg);
32
- return super.bootstrap(settings, Cli);
58
+ return super.bootstrap(opts, Cli);
59
+ }
60
+ static async dispatch(cmd, context) {
61
+ this.createAliases();
62
+ const cli = await this.create({ ...Cli.defaults }, Cli);
63
+ await cli.cliService.dispatch(cmd, context);
33
64
  }
34
65
  static createAliases() {
35
66
  alias.addAliases({
@@ -1 +1 @@
1
- {"version":3,"file":"Cli.js","sourceRoot":"","sources":["../../src/Cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,6DAA6D;AAC7D,aAAa;AACb,OAAO,KAAK,MAAM,cAAc,CAAC;AAEjC,MAAM,OAAO,GAAI,SAAQ,OAAO;IAC9B,MAAM,CAAC,YAAY,CAAC,GAAQ;QAC1B,IAAI,CAAC,GAAG,EAAE;YACR,OAAO,CAAC,GAAG,CA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AgB,EAAE,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC;YACnD,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;SAC1C,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import {CliCore} from \"@tsed/cli-core\";\nimport chalk from \"chalk\";\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport alias from \"module-alias\";\n\nexport class Cli extends CliCore {\n static checkPackage(pkg: any) {\n if (!pkg) {\n console.log(chalk.red(`settings.pkg is required. Require the package.json of your CLI when you bootstrap the CLI.`));\n process.exit(1);\n }\n }\n\n static checkName(name: string) {\n if (!name) {\n console.log(chalk.red(`settings.name is required. Add the name of your CLI.`));\n process.exit(1);\n }\n }\n\n static checkPrecondition(settings: any) {\n const {pkg} = settings;\n\n this.checkPackage(pkg);\n this.checkName(pkg.name);\n\n if (pkg?.engines?.node) {\n this.checkNodeVersion(pkg.engines.node, pkg.name);\n }\n }\n\n static async bootstrap(settings: any) {\n const {pkg} = settings;\n\n this.checkPrecondition(settings);\n this.createAliases();\n this.updateNotifier(pkg);\n\n return super.bootstrap(settings, Cli);\n }\n\n static createAliases() {\n alias.addAliases({\n \"@tsed/core\": require.resolve(\"@tsed/core\"),\n \"@tsed/di\": require.resolve(\"@tsed/di\"),\n \"@tsed/schema\": require.resolve(\"@tsed/schema\"),\n \"@tsed/cli-core\": require.resolve(\"@tsed/cli-core\"),\n \"@tsed/cli\": require.resolve(\"@tsed/cli\")\n });\n }\n}\n"]}
1
+ {"version":3,"file":"Cli.js","sourceRoot":"","sources":["../../src/Cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,6DAA6D;AAC7D,aAAa;AACb,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EAAC,GAAG,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAC9C,OA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nimport alias from \"module-alias\";\nimport {PKG, TEMPLATE_DIR} from \"./constants\";\nimport commands from \"./commands\";\nimport {ArchitectureConvention, ProjectConvention} from \"./interfaces\";\nimport {InitCmdContext} from \"./commands/init/interfaces/InitCmdContext\";\nimport {GenerateCmdContext} from \"./commands/generate/GenerateCmd\";\n\nexport class Cli extends CliCore {\n static defaults = {\n name: \"tsed\",\n pkg: PKG,\n templateDir: TEMPLATE_DIR,\n plugins: true,\n commands,\n defaultProjectPreferences() {\n return {\n convention: ProjectConvention.DEFAULT,\n architecture: ArchitectureConvention.DEFAULT\n };\n },\n project: {\n reinstallAfterRun: true\n },\n logger: {\n level: \"info\"\n }\n };\n\n static checkPackage(pkg: any) {\n if (!pkg) {\n console.log(chalk.red(`settings.pkg is required. Require the package.json of your CLI when you bootstrap the CLI.`));\n process.exit(1);\n }\n }\n\n static checkName(name: string) {\n if (!name) {\n console.log(chalk.red(`settings.name is required. Add the name of your CLI.`));\n process.exit(1);\n }\n }\n\n static checkPrecondition(settings: any) {\n const {pkg} = settings;\n\n this.checkPackage(pkg);\n this.checkName(pkg.name);\n\n if (pkg?.engines?.node) {\n this.checkNodeVersion(pkg.engines.node, pkg.name);\n }\n }\n\n static async bootstrap(settings: any = {}) {\n const opts: any = {\n ...Cli.defaults,\n ...settings\n };\n\n const {pkg} = opts;\n\n this.checkPrecondition(opts);\n this.createAliases();\n this.updateNotifier(pkg);\n\n return super.bootstrap(opts, Cli);\n }\n\n static async dispatch(cmd: \"init\", context: InitCmdContext): Promise<void>;\n static async dispatch(cmd: \"generate\", context: GenerateCmdContext): Promise<void>;\n static async dispatch(cmd: string, context: any) {\n this.createAliases();\n\n const cli = await this.create<Cli>({...Cli.defaults} as any, Cli);\n\n await cli.cliService.dispatch(cmd, context);\n }\n\n static createAliases() {\n alias.addAliases({\n \"@tsed/core\": require.resolve(\"@tsed/core\"),\n \"@tsed/di\": require.resolve(\"@tsed/di\"),\n \"@tsed/schema\": require.resolve(\"@tsed/schema\"),\n \"@tsed/cli-core\": require.resolve(\"@tsed/cli-core\"),\n \"@tsed/cli\": require.resolve(\"@tsed/cli\")\n });\n }\n}\n"]}
@@ -1,25 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { Cli } from "../Cli.js";
3
- import commands from "../commands.js";
4
- import { ArchitectureConvention, ProjectConvention } from "../interfaces.js";
5
- import { PKG, TEMPLATE_DIR } from "../constants.js";
6
- Cli.bootstrap({
7
- name: "tsed",
8
- pkg: PKG,
9
- templateDir: TEMPLATE_DIR,
10
- plugins: true,
11
- commands,
12
- defaultProjectPreferences() {
13
- return {
14
- convention: ProjectConvention.DEFAULT,
15
- architecture: ArchitectureConvention.DEFAULT
16
- };
17
- },
18
- project: {
19
- reinstallAfterRun: true
20
- },
21
- logger: {
22
- level: "info"
23
- }
24
- }).catch(console.error);
3
+ Cli.bootstrap({}).catch(console.error);
25
4
  //# sourceMappingURL=tsed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tsed.js","sourceRoot":"","sources":["../../../src/bin/tsed.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,GAAG,EAAC,MAAM,QAAQ,CAAC;AAC3B,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,sBAAsB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AACxE,OAAO,EAAC,GAAG,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAE/C,GAAG,CAAC,SAAS,CAAC;IACZ,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,GAAG;IACR,WAAW,EAAE,YAAY;IACzB,OAAO,EAAE,IAAI;IACb,QAAQ;IACR,yBAAyB;QACvB,OAAO;YACL,UAAU,EAAE,iBAAiB,CAAC,OAAO;YACrC,YAAY,EAAE,sBAAsB,CAAC,OAAO;SAC7C,CAAC;IACJ,CAAC;IACD,OAAO,EAAE;QACP,iBAAiB,EAAE,IAAI;KACxB;IACD,MAAM,EAAE;QACN,KAAK,EAAE,MAAM;KACd;CACF,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport {Cli} from \"../Cli\";\nimport commands from \"../commands\";\nimport {ArchitectureConvention, ProjectConvention} from \"../interfaces\";\nimport {PKG, TEMPLATE_DIR} from \"../constants\";\n\nCli.bootstrap({\n name: \"tsed\",\n pkg: PKG,\n templateDir: TEMPLATE_DIR,\n plugins: true,\n commands,\n defaultProjectPreferences() {\n return {\n convention: ProjectConvention.DEFAULT,\n architecture: ArchitectureConvention.DEFAULT\n };\n },\n project: {\n reinstallAfterRun: true\n },\n logger: {\n level: \"info\"\n }\n}).catch(console.error);\n"]}
1
+ {"version":3,"file":"tsed.js","sourceRoot":"","sources":["../../../src/bin/tsed.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,GAAG,EAAC,MAAM,QAAQ,CAAC;AAE3B,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport {Cli} from \"../Cli\";\n\nCli.bootstrap({}).catch(console.error);\n"]}