@tsed/cli 3.25.0 → 4.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/lib/cjs/Cli.js.map +1 -1
  2. package/lib/cjs/commands/init/InitCmd.js +70 -35
  3. package/lib/cjs/commands/init/InitCmd.js.map +1 -1
  4. package/lib/cjs/commands/init/config/FeaturesPrompt.js +406 -0
  5. package/lib/cjs/commands/init/config/FeaturesPrompt.js.map +1 -0
  6. package/lib/cjs/commands/init/config/InitFileSchema.js +53 -0
  7. package/lib/cjs/commands/init/config/InitFileSchema.js.map +1 -0
  8. package/lib/cjs/commands/init/interfaces/InitCmdContext.js +3 -0
  9. package/lib/cjs/commands/init/interfaces/InitCmdContext.js.map +1 -0
  10. package/lib/cjs/commands/init/interfaces/InitOptions.js +3 -0
  11. package/lib/cjs/commands/init/interfaces/InitOptions.js.map +1 -0
  12. package/lib/cjs/commands/init/interfaces/InitPromptAnswers.js +3 -0
  13. package/lib/cjs/commands/init/interfaces/InitPromptAnswers.js.map +1 -0
  14. package/lib/cjs/commands/init/mappers/mapToContext.js +16 -0
  15. package/lib/cjs/commands/init/mappers/mapToContext.js.map +1 -0
  16. package/lib/cjs/commands/init/mappers/mapUniqFeatures.js +18 -0
  17. package/lib/cjs/commands/init/mappers/mapUniqFeatures.js.map +1 -0
  18. package/lib/cjs/commands/init/prompts/getFeaturesPrompt.js +25 -0
  19. package/lib/cjs/commands/init/prompts/getFeaturesPrompt.js.map +1 -0
  20. package/lib/cjs/commands/init/utils/hasFeature.js +13 -0
  21. package/lib/cjs/commands/init/utils/hasFeature.js.map +1 -0
  22. package/lib/cjs/commands/init/utils/isPlatform.js +8 -0
  23. package/lib/cjs/commands/init/utils/isPlatform.js.map +1 -0
  24. package/lib/cjs/constants/index.js +3 -3
  25. package/lib/cjs/constants/index.js.map +1 -1
  26. package/lib/cjs/index.js +5 -1
  27. package/lib/cjs/index.js.map +1 -1
  28. package/lib/cjs/interfaces/PlatformType.js +9 -0
  29. package/lib/cjs/interfaces/PlatformType.js.map +1 -0
  30. package/lib/cjs/interfaces/index.js +1 -0
  31. package/lib/cjs/interfaces/index.js.map +1 -1
  32. package/lib/esm/Cli.js.map +1 -1
  33. package/lib/esm/commands/init/InitCmd.js +73 -38
  34. package/lib/esm/commands/init/InitCmd.js.map +1 -1
  35. package/lib/esm/commands/init/config/FeaturesPrompt.js +402 -0
  36. package/lib/esm/commands/init/config/FeaturesPrompt.js.map +1 -0
  37. package/lib/esm/commands/init/config/InitFileSchema.js +50 -0
  38. package/lib/esm/commands/init/config/InitFileSchema.js.map +1 -0
  39. package/lib/esm/commands/init/interfaces/InitCmdContext.js +2 -0
  40. package/lib/esm/commands/init/interfaces/InitCmdContext.js.map +1 -0
  41. package/lib/esm/commands/init/interfaces/InitOptions.js +2 -0
  42. package/lib/esm/commands/init/interfaces/InitOptions.js.map +1 -0
  43. package/lib/esm/commands/init/interfaces/InitPromptAnswers.js +2 -0
  44. package/lib/esm/commands/init/interfaces/InitPromptAnswers.js.map +1 -0
  45. package/lib/esm/commands/init/mappers/mapToContext.js +12 -0
  46. package/lib/esm/commands/init/mappers/mapToContext.js.map +1 -0
  47. package/lib/esm/commands/init/mappers/mapUniqFeatures.js +14 -0
  48. package/lib/esm/commands/init/mappers/mapUniqFeatures.js.map +1 -0
  49. package/lib/esm/commands/init/prompts/getFeaturesPrompt.js +21 -0
  50. package/lib/esm/commands/init/prompts/getFeaturesPrompt.js.map +1 -0
  51. package/lib/esm/commands/init/utils/hasFeature.js +8 -0
  52. package/lib/esm/commands/init/utils/hasFeature.js.map +1 -0
  53. package/lib/esm/commands/init/utils/isPlatform.js +4 -0
  54. package/lib/esm/commands/init/utils/isPlatform.js.map +1 -0
  55. package/lib/esm/constants/index.js +3 -3
  56. package/lib/esm/constants/index.js.map +1 -1
  57. package/lib/esm/index.js +5 -1
  58. package/lib/esm/index.js.map +1 -1
  59. package/lib/esm/interfaces/PlatformType.js +6 -0
  60. package/lib/esm/interfaces/PlatformType.js.map +1 -0
  61. package/lib/esm/interfaces/index.js +1 -0
  62. package/lib/esm/interfaces/index.js.map +1 -1
  63. package/lib/types/Cli.d.ts +2 -2
  64. package/lib/types/commands/init/InitCmd.d.ts +8 -24
  65. package/lib/types/commands/init/config/FeaturesPrompt.d.ts +98 -0
  66. package/lib/types/commands/init/config/InitFileSchema.d.ts +49 -0
  67. package/lib/types/commands/init/interfaces/InitCmdContext.d.ts +6 -0
  68. package/lib/types/commands/init/interfaces/InitOptions.d.ts +19 -0
  69. package/lib/types/commands/init/interfaces/InitPromptAnswers.d.ts +16 -0
  70. package/lib/types/commands/init/mappers/mapToContext.d.ts +2 -0
  71. package/lib/types/commands/init/mappers/mapUniqFeatures.d.ts +3 -0
  72. package/lib/types/commands/init/prompts/getFeaturesPrompt.d.ts +2 -0
  73. package/lib/types/commands/init/utils/hasFeature.d.ts +2 -0
  74. package/lib/types/commands/init/utils/isPlatform.d.ts +1 -0
  75. package/lib/types/constants/index.d.ts +2 -2
  76. package/lib/types/index.d.ts +5 -1
  77. package/lib/types/interfaces/PlatformType.d.ts +4 -0
  78. package/lib/types/interfaces/index.d.ts +1 -0
  79. package/package.json +14 -9
  80. package/readme.md +104 -14
  81. package/templates/init/tsconfig.json.hbs +5 -3
  82. package/lib/cjs/services/Features.js +0 -528
  83. package/lib/cjs/services/Features.js.map +0 -1
  84. package/lib/esm/services/Features.js +0 -519
  85. package/lib/esm/services/Features.js.map +0 -1
  86. package/lib/types/services/Features.d.ts +0 -412
package/lib/esm/index.js CHANGED
@@ -1,10 +1,14 @@
1
1
  export * from "./commands/add/AddCmd.js";
2
2
  export * from "./commands/init/InitCmd.js";
3
+ export * from "./commands/init/interfaces/InitCmdContext.js";
4
+ export * from "./commands/init/interfaces/InitOptions.js";
5
+ export * from "./commands/init/config/FeaturesPrompt.js";
6
+ export * from "./commands/init/config/FeaturesPrompt.js";
3
7
  export * from "./commands/generate/GenerateCmd.js";
4
8
  export * from "./commands/update/UpdateCmd.js";
9
+ export * from "./commands/init/prompts/getFeaturesPrompt.js";
5
10
  export * from "./interfaces.js";
6
11
  export * from "./services/ProvidersInfoService.js";
7
- export * from "./services/Features.js";
8
12
  export * from "./pipes.js";
9
13
  export * from "./constants.js";
10
14
  export * from "./Cli.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,cAAc,CAAC;AAC7B,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC","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\";\nexport * from \"./Cli\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,cAAc,CAAC;AAC7B,cAAc,iCAAiC,CAAC;AAChD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC","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,6 @@
1
+ export var PlatformType;
2
+ (function (PlatformType) {
3
+ PlatformType["EXPRESS"] = "express";
4
+ PlatformType["KOA"] = "koa";
5
+ })(PlatformType || (PlatformType = {}));
6
+ //# sourceMappingURL=PlatformType.js.map
@@ -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,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,49 @@
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
+ tsedVersion: {
8
+ type: string;
9
+ };
10
+ projectName: {
11
+ type: string;
12
+ maxLength: number;
13
+ };
14
+ platform: {
15
+ type: string;
16
+ description: string;
17
+ enum: PlatformType[];
18
+ default: PlatformType;
19
+ };
20
+ architecture: {
21
+ type: string;
22
+ enum: ArchitectureConvention[];
23
+ default: ArchitectureConvention;
24
+ };
25
+ convention: {
26
+ type: string;
27
+ enum: ProjectConvention[];
28
+ default: ProjectConvention;
29
+ };
30
+ features: {
31
+ type: string;
32
+ items: {
33
+ type: string;
34
+ enum: FeatureType[];
35
+ };
36
+ };
37
+ packageManager: {
38
+ type: string;
39
+ enum: PackageManager[];
40
+ default: PackageManager;
41
+ };
42
+ skipPrompt: {
43
+ type: string;
44
+ default: boolean;
45
+ };
46
+ };
47
+ required: string[];
48
+ additionalProperties: boolean;
49
+ };
@@ -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
+ }
@@ -0,0 +1,16 @@
1
+ import { PackageManager } from "@tsed/cli-core";
2
+ import { ArchitectureConvention, PlatformType, ProjectConvention } from "../../../interfaces";
3
+ export interface InitPromptAnswers {
4
+ projectName: string;
5
+ platform: PlatformType;
6
+ architecture: ArchitectureConvention;
7
+ convention: ProjectConvention;
8
+ features: string[];
9
+ featuresDB: string[];
10
+ featuresTypeORM: string;
11
+ featuresTesting: string;
12
+ featuresExtraLinter: string[];
13
+ featuresBundler: string;
14
+ oidcBasePath: string;
15
+ packageManager: PackageManager;
16
+ }
@@ -0,0 +1,2 @@
1
+ import { InitCmdContext } from "../interfaces/InitCmdContext";
2
+ export declare function mapToContext(options: any): InitCmdContext;
@@ -0,0 +1,3 @@
1
+ import { InitPromptAnswers } from "../interfaces/InitPromptAnswers";
2
+ import { InitOptions } from "../interfaces/InitOptions";
3
+ export declare function mapUniqFeatures(answers: InitPromptAnswers & any): InitOptions;
@@ -0,0 +1,2 @@
1
+ import { InitOptions } from "../interfaces/InitOptions";
2
+ export declare function getFeaturesPrompt(options: Partial<InitOptions>): any[];
@@ -0,0 +1,2 @@
1
+ export declare function hasValue(expression: string, value: any): (ctx: any) => boolean;
2
+ export declare function hasFeature(feature: string): (ctx: any) => boolean;
@@ -0,0 +1 @@
1
+ export declare function isPlatform(...types: string[]): (ctx: any) => boolean;
@@ -1,6 +1,6 @@
1
1
  export declare const PKG: import("read-pkg").NormalizedPackageJson;
2
- export declare const MINIMAL_TSED_VERSION = "6";
3
- export declare const DEFAULT_TSED_TAGS = "latest";
2
+ export declare const MINIMAL_TSED_VERSION = "7";
3
+ export declare const DEFAULT_TSED_TAGS = "rc";
4
4
  export declare const IGNORE_VERSIONS: string[];
5
5
  export declare const IGNORE_TAGS: false | RegExp;
6
6
  export declare const TEMPLATE_DIR: string;
@@ -1,10 +1,14 @@
1
1
  export * from "./commands/add/AddCmd";
2
2
  export * from "./commands/init/InitCmd";
3
+ export * from "./commands/init/interfaces/InitCmdContext";
4
+ export * from "./commands/init/interfaces/InitOptions";
5
+ export * from "./commands/init/config/FeaturesPrompt";
6
+ export * from "./commands/init/config/FeaturesPrompt";
3
7
  export * from "./commands/generate/GenerateCmd";
4
8
  export * from "./commands/update/UpdateCmd";
9
+ export * from "./commands/init/prompts/getFeaturesPrompt";
5
10
  export * from "./interfaces";
6
11
  export * from "./services/ProvidersInfoService";
7
- export * from "./services/Features";
8
12
  export * from "./pipes";
9
13
  export * from "./constants";
10
14
  export * from "./Cli";
@@ -0,0 +1,4 @@
1
+ export declare enum PlatformType {
2
+ EXPRESS = "express",
3
+ KOA = "koa"
4
+ }
@@ -1,2 +1,3 @@
1
1
  export * from "./ProjectConvention";
2
+ export * from "./PlatformType";
2
3
  export * from "./ArchitectureConvention";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/cli",
3
- "version": "3.25.0",
3
+ "version": "4.0.0-rc.2",
4
4
  "source": "./src/index.ts",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -17,9 +17,11 @@
17
17
  "build:esm": "tsc --build tsconfig.compile.esm.json",
18
18
  "start:help": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts -h",
19
19
  "start:help:g": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts generate -h",
20
+ "start:help:i": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts init -h",
20
21
  "start:version": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts --version",
21
22
  "start:init:help": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts init -h",
22
23
  "start:init:run": "cross-env NODE_ENV=development cross-env CI=true ts-node -r tsconfig-paths/register src/bin/tsed.ts init -r ./.tmp/init/default",
24
+ "start:init:params": "cross-env NODE_ENV=development cross-env CI=true ts-node -r tsconfig-paths/register src/bin/tsed.ts init -r ./.tmp/init/default --skip-prompt --features swagger,jest,lintstaged",
23
25
  "start:init:run:name": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts init -r ./.tmp/init awesome --verbose",
24
26
  "start:add:run": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts add -r ./.tmp",
25
27
  "start:generate": "cross-env NODE_ENV=development ts-node -r tsconfig-paths/register src/bin/tsed.ts generate -r ./.tmp/init/default",
@@ -56,12 +58,12 @@
56
58
  "node": ">=14"
57
59
  },
58
60
  "dependencies": {
59
- "@tsed/cli-core": "3.25.0",
60
- "@tsed/core": ">=6.114.14",
61
- "@tsed/di": ">=6.114.14",
62
- "@tsed/logger": ">=6.0.0",
63
- "@tsed/openspec": ">=6.114.14",
64
- "@tsed/schema": ">=6.114.14",
61
+ "@tsed/cli-core": "4.0.0-rc.2",
62
+ "@tsed/core": ">=7.0.0-rc.5",
63
+ "@tsed/di": ">=7.0.0-rc.5",
64
+ "@tsed/logger": ">=6.2.1",
65
+ "@tsed/openspec": ">=7.0.0-rc.5",
66
+ "@tsed/schema": ">=7.0.0-rc.5",
65
67
  "chalk": "4.1.2",
66
68
  "change-case": "4.1.2",
67
69
  "filedirname": "2.7.0",
@@ -80,7 +82,10 @@
80
82
  "bugs": {
81
83
  "url": "https://github.com/tsedio/tsed-cli/issues"
82
84
  },
83
- "homepage": "https://github.com/tsedio/tsed-cli/tree/master/packages/cli",
85
+ "homepage": "https://github.com/tsedio/tsed-cli/tree/rc/packages/cli",
84
86
  "author": "Romain Lenzotti",
85
- "license": "MIT"
87
+ "license": "MIT",
88
+ "publishConfig": {
89
+ "tag": "rc"
90
+ }
86
91
  }
package/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- # @tsed/cli
1
+ # @tsed/cli
2
2
 
3
3
  <p style="text-align: center" align="center">
4
4
  <a href="https://tsed.io" target="_blank"><img src="https://tsed.io/tsed-og.png" width="200" alt="Ts.ED logo"/></a>
@@ -48,6 +48,103 @@ https_proxy=http://username:password@host:port
48
48
  > Note: The following environment variables can be also used to configure the proxy `HTTPS_PROXY`, `HTTP_PROXY`
49
49
  > and `NODE_TLS_REJECT_UNAUTHORIZED`.
50
50
 
51
+ ## Commands
52
+
53
+ ```shell
54
+ Usage: tsed [options] [command]
55
+
56
+ Options:
57
+ -V, --version output the version number
58
+ -h, --help display help for command
59
+
60
+ Commands:
61
+ add [options] [name] Add cli plugin to the current project
62
+ generate|g [options] [type] [name] Generate a new provider class
63
+ update [options] Update all Ts.ED packages used by your project
64
+ init [options] [root] Init a new Ts.ED project
65
+ run [options] <command> Run a project level command
66
+ help [command] display help for commands
67
+ ```
68
+
69
+ ## Init project
70
+
71
+ ```shell
72
+ Usage: tsed init [options] [root]
73
+
74
+ Init a new Ts.ED project
75
+
76
+ Arguments:
77
+ root Root directory to initialize the Ts.ED project (default: ".")
78
+
79
+ Options:
80
+ -n, --project-name <projectName> Set the project name. By default, the project is the same as the name directory. (default: "")
81
+ -a, --arch <architecture> Set the default architecture convention (default or feature) (default: "default")
82
+ -c, --convention <convention> Set the default project convention (default or feature) (default: "default")
83
+ -p, --platform <platform> Set the default platform for Ts.ED (express or koa) (default: "express")
84
+ --features <features...> List of the Ts.ED features. (default: [])
85
+ -m, --package-manager <packageManager> The default package manager to install the project (default: "yarn")
86
+ -t, --tsed-version <version> Use a specific version of Ts.ED (format: 5.x.x). (default: "latest")
87
+ -f, --file <path> Location of a file in which the features are defined.
88
+ -s, --skip-prompt Skip the prompt. (default: false)
89
+ -r, --root-dir <path> Project root directory
90
+ --verbose Verbose mode
91
+ -h, --help display help for command
92
+ ```
93
+
94
+ Interactive prompt:
95
+
96
+ ```shell
97
+ tsed init .
98
+ ```
99
+
100
+ Skip prompt:
101
+
102
+ ```shell
103
+ tsed init . --platform express --package-manager yarn --features swagger,jest,eslint,lintstaged,prettier --skip-prompt
104
+ ```
105
+
106
+ ## Use file to generate project
107
+
108
+ A file can be defined to generate project. For example create a `tsed.template.yml` and add this code:
109
+
110
+ ```yaml
111
+ projectName: project-example
112
+ platform: express
113
+ architecture: default
114
+ convention: default
115
+ skipPrompt: true
116
+ packageManager: yarn
117
+ features:
118
+ - graphql
119
+ - socketio
120
+ - swagger
121
+ - oidc
122
+ - passportjs
123
+ - commands
124
+ - db
125
+ - prisma
126
+ - mongoose
127
+ - typeorm
128
+ - typeorm:mysql
129
+ - testing
130
+ - jest
131
+ - mocha
132
+ - linter
133
+ - eslint
134
+ - lintstaged
135
+ - prettier
136
+ - bundler
137
+ - babel
138
+ - babel:webpack
139
+ ```
140
+ > Note: The CLI support `yml` and `json` file!
141
+
142
+ Then:
143
+
144
+ ```shell
145
+ tsed init . --file ./tsed.template.yml
146
+ ```
147
+
51
148
  ## Run Cli from code
52
149
 
53
150
  ```typescript
@@ -60,21 +157,21 @@ Cli.dispatch("init", {
60
157
  ```
61
158
 
62
159
  ## Contributors
63
-
64
160
  Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html)
65
161
 
66
162
  <a href="https://github.com/tsedio/ts-express-decorators/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
67
163
 
164
+
68
165
  ## Backers
69
166
 
70
167
  Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/tsed#backer)]
71
168
 
72
169
  <a href="https://opencollective.com/tsed#backers" target="_blank"><img src="https://opencollective.com/tsed/tiers/backer.svg?width=890"></a>
73
170
 
171
+
74
172
  ## Sponsors
75
173
 
76
- Support this project by becoming a sponsor. Your logo will show up here with a link to your
77
- website. [[Become a sponsor](https://opencollective.com/tsed#sponsor)]
174
+ Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/tsed#sponsor)]
78
175
 
79
176
  ## License
80
177
 
@@ -82,15 +179,8 @@ The MIT License (MIT)
82
179
 
83
180
  Copyright (c) 2016 - 2018 Romain Lenzotti
84
181
 
85
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
86
- documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
87
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
88
- persons to whom the Software is furnished to do so, subject to the following conditions:
182
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
89
183
 
90
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
91
- Software.
184
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
92
185
 
93
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
94
- WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
95
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
96
- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
186
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "baseUrl": ".",
4
- "sourceRoot": "src",
5
4
  "module": "commonjs",
6
5
  "target": "esnext",
7
6
  "sourceMap": true,
@@ -30,8 +29,11 @@
30
29
  "./node_modules/@types"
31
30
  ]
32
31
  },
33
- "include": [
34
- "src"
32
+ "exclude": [
33
+ "node_modules",
34
+ "./public",
35
+ "dist",
36
+ "test"
35
37
  ],
36
38
  "linterOptions": {
37
39
  "exclude": []