@tsed/cli 3.25.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 (80) hide show
  1. package/lib/cjs/Cli.js.map +1 -1
  2. package/lib/cjs/commands/init/InitCmd.js +58 -34
  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 +49 -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/index.js +5 -1
  25. package/lib/cjs/index.js.map +1 -1
  26. package/lib/cjs/interfaces/PlatformType.js +9 -0
  27. package/lib/cjs/interfaces/PlatformType.js.map +1 -0
  28. package/lib/cjs/interfaces/index.js +1 -0
  29. package/lib/cjs/interfaces/index.js.map +1 -1
  30. package/lib/cjs/services/Features.js +118 -133
  31. package/lib/cjs/services/Features.js.map +1 -1
  32. package/lib/esm/Cli.js.map +1 -1
  33. package/lib/esm/commands/init/InitCmd.js +61 -37
  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 +46 -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/index.js +5 -1
  56. package/lib/esm/index.js.map +1 -1
  57. package/lib/esm/interfaces/PlatformType.js +6 -0
  58. package/lib/esm/interfaces/PlatformType.js.map +1 -0
  59. package/lib/esm/interfaces/index.js +1 -0
  60. package/lib/esm/interfaces/index.js.map +1 -1
  61. package/lib/esm/services/Features.js +117 -128
  62. package/lib/esm/services/Features.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 +45 -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/index.d.ts +5 -1
  76. package/lib/types/interfaces/PlatformType.d.ts +4 -0
  77. package/lib/types/interfaces/index.d.ts +1 -0
  78. package/lib/types/services/Features.d.ts +0 -18
  79. package/package.json +7 -4
  80. package/readme.md +6 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlatformType.js","sourceRoot":"","sources":["../../../src/interfaces/PlatformType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,2BAAW,CAAA;AACb,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB","sourcesContent":["export enum PlatformType {\n EXPRESS = \"express\",\n KOA = \"koa\"\n}\n"]}
@@ -1,3 +1,4 @@
1
1
  export * from "./ProjectConvention.js";
2
+ export * from "./PlatformType.js";
2
3
  export * from "./ArchitectureConvention.js";
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./ProjectConvention\";\nexport * from \"./ArchitectureConvention\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./ProjectConvention\";\nexport * from \"./PlatformType\";\nexport * from \"./ArchitectureConvention\";\n"]}
@@ -1,18 +1,5 @@
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
- }
1
+ import { ProjectConvention } from "../interfaces.js";
2
+ import { isPlatform } from "../commands/init/utils/isPlatform.js";
16
3
  export const FEATURES_TYPEORM_CONNECTION_TYPES = [
17
4
  {
18
5
  name: "MySQL",
@@ -403,117 +390,119 @@ export const getFeaturesChoicesValues = (cliVersion) => {
403
390
  packageManager: packageManagerChoices.map((v) => v.value)
404
391
  };
405
392
  };
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
- });
393
+ //
394
+ // registerProvider({
395
+ // provide: Features,
396
+ // deps: [CliPackageJson],
397
+ // useFactory(cliPackageJson: CliPackageJson) {
398
+ // const cliVersion = cliPackageJson.version;
399
+ //
400
+ // return [
401
+ // {
402
+ // message: "Choose the target platform:",
403
+ // type: "list",
404
+ // name: "platform",
405
+ // choices: platformChoices
406
+ // },
407
+ // {
408
+ // message: "Choose the architecture for your project:",
409
+ // type: "list",
410
+ // name: "architecture",
411
+ // choices: [
412
+ // {
413
+ // name: "Ts.ED",
414
+ // checked: true,
415
+ // value: ArchitectureConvention.DEFAULT
416
+ // },
417
+ // {
418
+ // name: "feature",
419
+ // checked: false,
420
+ // value: ArchitectureConvention.FEATURE
421
+ // }
422
+ // ]
423
+ // },
424
+ // {
425
+ // message: "Choose the convention file styling:",
426
+ // type: "list",
427
+ // name: "convention",
428
+ // choices: conventionChoices
429
+ // },
430
+ // {
431
+ // type: "checkbox",
432
+ // name: "features",
433
+ // message: "Check the features needed for your project",
434
+ // choices: featureChoices(cliVersion)
435
+ // },
436
+ // {
437
+ // message: "Choose a ORM manager",
438
+ // type: "list",
439
+ // name: "featuresDB",
440
+ // when: hasFeature("db"),
441
+ // choices: featuresDbChoices(cliVersion)
442
+ // },
443
+ // {
444
+ // type: "list",
445
+ // name: "featuresTypeORM",
446
+ // message: "Which TypeORM you want to install?",
447
+ // choices: FEATURES_TYPEORM_CONNECTION_TYPES,
448
+ // when: hasValue("featuresDB.type", "typeorm")
449
+ // },
450
+ // // {
451
+ // // type: "password",
452
+ // // name: "GH_TOKEN",
453
+ // // message:
454
+ // // "Enter GH_TOKEN to use the premium @tsedio/prisma package or leave blank (see https://tsed.io/tutorials/prisma-client.html)",
455
+ // // when: hasValue("featuresDB.type", "prisma")
456
+ // // },
457
+ // {
458
+ // message: "Choose unit framework",
459
+ // type: "list",
460
+ // name: "featuresTesting",
461
+ // when: hasFeature("testing"),
462
+ // choices: featuresTestingChoices(cliVersion)
463
+ // },
464
+ // {
465
+ // message: "Choose linter tools framework",
466
+ // type: "list",
467
+ // name: "featuresLinter",
468
+ // when: hasFeature("linter"),
469
+ // choices: featuresLinterChoices(cliVersion)
470
+ // },
471
+ // {
472
+ // message: "Choose extra linter tools",
473
+ // type: "checkbox",
474
+ // name: "featuresExtraLinter",
475
+ // when: hasFeature("linter"),
476
+ // choices: featuresExtraLinterChoices
477
+ // },
478
+ // {
479
+ // message: "Choose your bundler",
480
+ // type: "list",
481
+ // name: "featuresBundler",
482
+ // when: hasFeature("bundler"),
483
+ // choices: featuresBundlerChoices
484
+ // },
485
+ // {
486
+ // message: "Choose the OIDC base path server",
487
+ // name: "oidcBasePath",
488
+ // default: "/oidc",
489
+ // when: hasFeature("oidc"),
490
+ // type: "input"
491
+ // },
492
+ // {
493
+ // message: "Choose the OIDC base path server",
494
+ // name: "oidcBasePath",
495
+ // default: "/oidc",
496
+ // when: hasFeature("oidc"),
497
+ // type: "input"
498
+ // },
499
+ // {
500
+ // message: "Choose the package manager:",
501
+ // type: "list",
502
+ // name: "packageManager",
503
+ // choices: packageManagerChoices
504
+ // }
505
+ // ];
506
+ // }
507
+ // });
519
508
  //# sourceMappingURL=Features.js.map
@@ -1 +1 @@
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;IACx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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,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,UAAU,EAAC,MAA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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"]}
@@ -1,6 +1,6 @@
1
1
  import { CliCore } from "@tsed/cli-core";
2
2
  import { ArchitectureConvention, ProjectConvention } from "./interfaces";
3
- import { InitCmdContext } from "./commands/init/InitCmd";
3
+ import { InitCmdContext } from "./commands/init/interfaces/InitCmdContext";
4
4
  import { GenerateCmdContext } from "./commands/generate/GenerateCmd";
5
5
  export declare class Cli extends CliCore {
6
6
  static defaults: {
@@ -8,7 +8,7 @@ export declare class Cli extends CliCore {
8
8
  pkg: import("read-pkg").NormalizedPackageJson;
9
9
  templateDir: string;
10
10
  plugins: boolean;
11
- commands: (typeof import("./commands/init/InitCmd").InitCmd | typeof import("./commands/generate/GenerateCmd").GenerateCmd | typeof import(".").UpdateCmd | typeof import(".").AddCmd | typeof import("./commands/run/RunCmd").RunCmd)[];
11
+ commands: (typeof import(".").InitCmd | typeof import("./commands/generate/GenerateCmd").GenerateCmd | typeof import(".").UpdateCmd | typeof import(".").AddCmd | typeof import("./commands/run/RunCmd").RunCmd)[];
12
12
  defaultProjectPreferences(): {
13
13
  convention: ProjectConvention;
14
14
  architecture: ArchitectureConvention;
@@ -1,37 +1,21 @@
1
- import { CliDefaultOptions, CliExeca, CliFs, CliPlugins, CliService, CommandProvider, Configuration, InstallOptions, ProjectPackageJson, QuestionOptions, RootRendererService } from "@tsed/cli-core";
2
- import { ArchitectureConvention } from "../../interfaces/ArchitectureConvention";
3
- import { ProjectConvention } from "../../interfaces/ProjectConvention";
1
+ import { CliExeca, CliFs, CliLoadFile, CliPackageJson, CliPlugins, CliService, CommandProvider, Configuration, ProjectPackageJson, QuestionOptions, RootRendererService } from "@tsed/cli-core";
4
2
  import { OutputFilePathPipe } from "../../pipes/OutputFilePathPipe";
5
- import { Features, FeatureValue } from "../../services/Features";
6
- export interface InitCmdContext extends CliDefaultOptions, InstallOptions {
7
- platform: "express" | "koa";
8
- root: string;
9
- srcDir: string;
10
- projectName: string;
11
- tsedVersion: string;
12
- features: FeatureValue[];
13
- featuresTypeORM?: FeatureValue;
14
- babel?: boolean;
15
- webpack?: boolean;
16
- architecture?: ArchitectureConvention;
17
- convention?: ProjectConvention;
18
- commands?: boolean;
19
- GH_TOKEN?: string;
20
- [key: string]: any;
21
- }
3
+ import { InitCmdContext } from "./interfaces/InitCmdContext";
4
+ import { InitOptions } from "./interfaces/InitOptions";
22
5
  export declare class InitCmd implements CommandProvider {
23
6
  protected configuration: Configuration;
24
7
  protected cliPlugins: CliPlugins;
25
8
  protected packageJson: ProjectPackageJson;
26
- protected features: Features;
9
+ protected cliPackageJson: CliPackageJson;
27
10
  protected cliService: CliService;
11
+ protected cliLoadFile: CliLoadFile;
28
12
  protected rootRenderer: RootRendererService;
29
13
  protected outputFilePathPipe: OutputFilePathPipe;
30
14
  protected execa: CliExeca;
31
15
  protected fs: CliFs;
32
- $beforePrompt(initialOptions: Partial<InitCmdContext>): Promise<Partial<InitCmdContext>>;
33
- $prompt(initialOptions: Partial<InitCmdContext>): QuestionOptions;
34
- $mapContext(ctx: Partial<InitCmdContext>): InitCmdContext;
16
+ $beforePrompt(initialOptions: Partial<InitOptions>): Promise<any>;
17
+ $prompt(initialOptions: Partial<InitOptions>): QuestionOptions;
18
+ $mapContext(ctx: any): InitCmdContext;
35
19
  $beforeExec(ctx: InitCmdContext): Promise<any>;
36
20
  $exec(ctx: InitCmdContext): Promise<{
37
21
  title: string;
@@ -0,0 +1,98 @@
1
+ import { PackageManager } from "@tsed/cli-core";
2
+ import { InitOptions } from "../interfaces/InitOptions";
3
+ import { ArchitectureConvention, PlatformType, ProjectConvention } from "../../../interfaces";
4
+ export interface Feature {
5
+ name: string;
6
+ value?: any;
7
+ checked?: boolean | ((opts: Partial<InitOptions>) => boolean);
8
+ when?: (opts: any) => boolean;
9
+ dependencies?: Record<string, any>;
10
+ devDependencies?: Record<string, any>;
11
+ }
12
+ export declare enum FeatureType {
13
+ GRAPHQL = "graphql",
14
+ SOCKETIO = "socketio",
15
+ SWAGGER = "swagger",
16
+ OIDC = "oidc",
17
+ PASSPORTJS = "passportjs",
18
+ COMMANDS = "commands",
19
+ DB = "db",
20
+ PRISMA = "prisma",
21
+ MONGOOSE = "mongoose",
22
+ TYPEORM = "typeorm",
23
+ TYPEORM_MYSQL = "typeorm:mysql",
24
+ TYPEORM_MARIADB = "typeorm:mariadb",
25
+ TYPEORM_POSTGRES = "typeorm:postgres",
26
+ TYPEORM_COCKROACHDB = "typeorm:cockroachdb",
27
+ TYPEORM_SQLITE = "typeorm:sqlite",
28
+ TYPEORM_BETTER_SQLITE3 = "typeorm:better-sqlite3",
29
+ TYPEORM_CORDOVA = "typeorm:cordova",
30
+ TYPEORM_NATIVESCRIPT = "typeorm:nativescript",
31
+ TYPEORM_ORACLE = "typeorm:oracle",
32
+ TYPEORM_MSSQL = "typeorm:mssql",
33
+ TYPEORM_MONGODB = "typeorm:mongodb",
34
+ TYPEORM_SQLJS = "typeorm:sqljs",
35
+ TYPEORM_REACTNATIVE = "typeorm:reactnative",
36
+ TYPEORM_EXPO = "typeorm:expo",
37
+ TESTING = "testing",
38
+ JEST = "jest",
39
+ MOCHA = "mocha",
40
+ LINTER = "linter",
41
+ ESLINT = "eslint",
42
+ LINT_STAGED = "lintstaged",
43
+ PRETTIER = "prettier",
44
+ BUNDLER = "bundler",
45
+ BABEL = "babel",
46
+ WEBPACK = "babel:webpack"
47
+ }
48
+ export declare const FeaturesMap: Record<string, Feature>;
49
+ export declare const FeaturesPrompt: () => ({
50
+ message: string;
51
+ type: string;
52
+ name: string;
53
+ choices: PlatformType[];
54
+ when?: undefined;
55
+ default?: undefined;
56
+ } | {
57
+ message: string;
58
+ type: string;
59
+ name: string;
60
+ choices: ArchitectureConvention[];
61
+ when?: undefined;
62
+ default?: undefined;
63
+ } | {
64
+ message: string;
65
+ type: string;
66
+ name: string;
67
+ choices: ProjectConvention[];
68
+ when?: undefined;
69
+ default?: undefined;
70
+ } | {
71
+ type: string;
72
+ name: string;
73
+ message: string;
74
+ choices: FeatureType[];
75
+ when?: undefined;
76
+ default?: undefined;
77
+ } | {
78
+ message: string;
79
+ type: string;
80
+ name: string;
81
+ when: (ctx: any) => boolean;
82
+ choices: FeatureType[];
83
+ default?: undefined;
84
+ } | {
85
+ message: string;
86
+ name: string;
87
+ default: string;
88
+ when: (ctx: any) => boolean;
89
+ type: string;
90
+ choices?: undefined;
91
+ } | {
92
+ message: string;
93
+ type: string;
94
+ name: string;
95
+ choices: PackageManager[];
96
+ when?: undefined;
97
+ default?: undefined;
98
+ })[];
@@ -0,0 +1,45 @@
1
+ import { PackageManager } from "@tsed/cli-core";
2
+ import { ArchitectureConvention, PlatformType, ProjectConvention } from "../../../interfaces";
3
+ import { FeatureType } from "./FeaturesPrompt";
4
+ export declare const InitFileSchema: {
5
+ type: string;
6
+ properties: {
7
+ platform: {
8
+ type: string;
9
+ description: string;
10
+ enum: PlatformType[];
11
+ default: PlatformType;
12
+ };
13
+ projectName: {
14
+ type: string;
15
+ maxLength: number;
16
+ };
17
+ tsedVersion: {
18
+ type: string;
19
+ };
20
+ features: {
21
+ type: string;
22
+ items: {
23
+ type: string;
24
+ enum: FeatureType[];
25
+ };
26
+ };
27
+ architecture: {
28
+ type: string;
29
+ enum: ArchitectureConvention[];
30
+ default: ArchitectureConvention;
31
+ };
32
+ convention: {
33
+ type: string;
34
+ enum: ProjectConvention[];
35
+ default: ProjectConvention;
36
+ };
37
+ packageManager: {
38
+ type: string;
39
+ enum: PackageManager[];
40
+ default: PackageManager;
41
+ };
42
+ };
43
+ required: string[];
44
+ additionalProperties: boolean;
45
+ };
@@ -0,0 +1,6 @@
1
+ import { CliDefaultOptions } from "@tsed/cli-core";
2
+ import { InitOptions } from "./InitOptions";
3
+ export interface InitCmdContext extends InitOptions, CliDefaultOptions, Record<string, any> {
4
+ root: string;
5
+ srcDir: string;
6
+ }
@@ -0,0 +1,19 @@
1
+ import { PackageManager } from "@tsed/cli-core";
2
+ import { PlatformType } from "../../../interfaces/PlatformType";
3
+ import { ArchitectureConvention } from "../../../interfaces/ArchitectureConvention";
4
+ import { ProjectConvention } from "../../../interfaces/ProjectConvention";
5
+ import { FeatureType } from "../config/FeaturesPrompt";
6
+ export interface InitOptions {
7
+ root: string;
8
+ projectName: string;
9
+ features: FeatureType[];
10
+ skipPrompt: boolean;
11
+ platform: PlatformType;
12
+ tsedVersion: string;
13
+ cliVersion: string;
14
+ architecture: ArchitectureConvention;
15
+ convention: ProjectConvention;
16
+ packageManager: PackageManager;
17
+ oidcBasePath: string;
18
+ file: string;
19
+ }