@tsed/cli 3.24.1 → 3.26.0

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 (87) 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 +70 -35
  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 +53 -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/esm/Cli.js +35 -4
  34. package/lib/esm/Cli.js.map +1 -1
  35. package/lib/esm/bin/tsed.js +1 -22
  36. package/lib/esm/bin/tsed.js.map +1 -1
  37. package/lib/esm/commands/init/InitCmd.js +73 -38
  38. package/lib/esm/commands/init/InitCmd.js.map +1 -1
  39. package/lib/esm/commands/init/config/FeaturesPrompt.js +402 -0
  40. package/lib/esm/commands/init/config/FeaturesPrompt.js.map +1 -0
  41. package/lib/esm/commands/init/config/InitFileSchema.js +50 -0
  42. package/lib/esm/commands/init/config/InitFileSchema.js.map +1 -0
  43. package/lib/esm/commands/init/interfaces/InitCmdContext.js +2 -0
  44. package/lib/esm/commands/init/interfaces/InitCmdContext.js.map +1 -0
  45. package/lib/esm/commands/init/interfaces/InitOptions.js +2 -0
  46. package/lib/esm/commands/init/interfaces/InitOptions.js.map +1 -0
  47. package/lib/esm/commands/init/interfaces/InitPromptAnswers.js +2 -0
  48. package/lib/esm/commands/init/interfaces/InitPromptAnswers.js.map +1 -0
  49. package/lib/esm/commands/init/mappers/mapToContext.js +12 -0
  50. package/lib/esm/commands/init/mappers/mapToContext.js.map +1 -0
  51. package/lib/esm/commands/init/mappers/mapUniqFeatures.js +14 -0
  52. package/lib/esm/commands/init/mappers/mapUniqFeatures.js.map +1 -0
  53. package/lib/esm/commands/init/prompts/getFeaturesPrompt.js +21 -0
  54. package/lib/esm/commands/init/prompts/getFeaturesPrompt.js.map +1 -0
  55. package/lib/esm/commands/init/utils/hasFeature.js +8 -0
  56. package/lib/esm/commands/init/utils/hasFeature.js.map +1 -0
  57. package/lib/esm/commands/init/utils/isPlatform.js +4 -0
  58. package/lib/esm/commands/init/utils/isPlatform.js.map +1 -0
  59. package/lib/esm/index.js +6 -1
  60. package/lib/esm/index.js.map +1 -1
  61. package/lib/esm/interfaces/PlatformType.js +6 -0
  62. package/lib/esm/interfaces/PlatformType.js.map +1 -0
  63. package/lib/esm/interfaces/index.js +1 -0
  64. package/lib/esm/interfaces/index.js.map +1 -1
  65. package/lib/types/Cli.d.ts +23 -1
  66. package/lib/types/commands/index.d.ts +1 -1
  67. package/lib/types/commands/init/InitCmd.d.ts +8 -24
  68. package/lib/types/commands/init/config/FeaturesPrompt.d.ts +98 -0
  69. package/lib/types/commands/init/config/InitFileSchema.d.ts +49 -0
  70. package/lib/types/commands/init/interfaces/InitCmdContext.d.ts +6 -0
  71. package/lib/types/commands/init/interfaces/InitOptions.d.ts +19 -0
  72. package/lib/types/commands/init/interfaces/InitPromptAnswers.d.ts +16 -0
  73. package/lib/types/commands/init/mappers/mapToContext.d.ts +2 -0
  74. package/lib/types/commands/init/mappers/mapUniqFeatures.d.ts +3 -0
  75. package/lib/types/commands/init/prompts/getFeaturesPrompt.d.ts +2 -0
  76. package/lib/types/commands/init/utils/hasFeature.d.ts +2 -0
  77. package/lib/types/commands/init/utils/isPlatform.d.ts +1 -0
  78. package/lib/types/index.d.ts +6 -1
  79. package/lib/types/interfaces/PlatformType.d.ts +4 -0
  80. package/lib/types/interfaces/index.d.ts +1 -0
  81. package/package.json +4 -2
  82. package/readme.md +124 -8
  83. package/lib/cjs/services/Features.js +0 -528
  84. package/lib/cjs/services/Features.js.map +0 -1
  85. package/lib/esm/services/Features.js +0 -519
  86. package/lib/esm/services/Features.js.map +0 -1
  87. package/lib/types/services/Features.d.ts +0 -412
@@ -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,8 +1,30 @@
1
1
  import { CliCore } from "@tsed/cli-core";
2
+ import { ArchitectureConvention, ProjectConvention } from "./interfaces";
3
+ import { InitCmdContext } from "./commands/init/interfaces/InitCmdContext";
4
+ import { GenerateCmdContext } from "./commands/generate/GenerateCmd";
2
5
  export declare class Cli extends CliCore {
6
+ static defaults: {
7
+ name: string;
8
+ pkg: import("read-pkg").NormalizedPackageJson;
9
+ templateDir: string;
10
+ plugins: boolean;
11
+ commands: (typeof import(".").InitCmd | typeof import("./commands/generate/GenerateCmd").GenerateCmd | typeof import(".").UpdateCmd | typeof import(".").AddCmd | typeof import("./commands/run/RunCmd").RunCmd)[];
12
+ defaultProjectPreferences(): {
13
+ convention: ProjectConvention;
14
+ architecture: ArchitectureConvention;
15
+ };
16
+ project: {
17
+ reinstallAfterRun: boolean;
18
+ };
19
+ logger: {
20
+ level: string;
21
+ };
22
+ };
3
23
  static checkPackage(pkg: any): void;
4
24
  static checkName(name: string): void;
5
25
  static checkPrecondition(settings: any): void;
6
- static bootstrap(settings: any): Promise<CliCore>;
26
+ static bootstrap(settings?: any): Promise<CliCore>;
27
+ static dispatch(cmd: "init", context: InitCmdContext): Promise<void>;
28
+ static dispatch(cmd: "generate", context: GenerateCmdContext): Promise<void>;
7
29
  static createAliases(): void;
8
30
  }
@@ -3,5 +3,5 @@ import { GenerateCmd } from "./generate/GenerateCmd";
3
3
  import { UpdateCmd } from "./update/UpdateCmd";
4
4
  import { AddCmd } from "./add/AddCmd";
5
5
  import { RunCmd } from "./run/RunCmd";
6
- declare const _default: (typeof AddCmd | typeof InitCmd | typeof GenerateCmd | typeof UpdateCmd | typeof RunCmd)[];
6
+ declare const _default: (typeof InitCmd | typeof GenerateCmd | typeof UpdateCmd | typeof AddCmd | typeof RunCmd)[];
7
7
  export default _default;
@@ -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,9 +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";
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.24.1",
3
+ "version": "3.26.0",
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,7 +58,7 @@
56
58
  "node": ">=14"
57
59
  },
58
60
  "dependencies": {
59
- "@tsed/cli-core": "3.24.1",
61
+ "@tsed/cli-core": "3.26.0",
60
62
  "@tsed/core": ">=6.114.14",
61
63
  "@tsed/di": ">=6.114.14",
62
64
  "@tsed/logger": ">=6.0.0",
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>
@@ -45,24 +45,133 @@ https-proxy=http://username:password@host:port
45
45
  https_proxy=http://username:password@host:port
46
46
  ```
47
47
 
48
- > Note: The following environment variables can be also used to configure the proxy `HTTPS_PROXY`, `HTTP_PROXY` and `NODE_TLS_REJECT_UNAUTHORIZED`.
48
+ > Note: The following environment variables can be also used to configure the proxy `HTTPS_PROXY`, `HTTP_PROXY`
49
+ > and `NODE_TLS_REJECT_UNAUTHORIZED`.
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
+
148
+ ## Run Cli from code
149
+
150
+ ```typescript
151
+ import {Cli} from "@tsed/cli";
152
+
153
+ Cli.dispatch("init", {
154
+ //... init options
155
+ });
156
+
157
+ ```
49
158
 
50
159
  ## Contributors
160
+
51
161
  Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html)
52
162
 
53
163
  <a href="https://github.com/tsedio/ts-express-decorators/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
54
164
 
55
-
56
165
  ## Backers
57
166
 
58
167
  Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/tsed#backer)]
59
168
 
60
169
  <a href="https://opencollective.com/tsed#backers" target="_blank"><img src="https://opencollective.com/tsed/tiers/backer.svg?width=890"></a>
61
170
 
62
-
63
171
  ## Sponsors
64
172
 
65
- 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)]
173
+ Support this project by becoming a sponsor. Your logo will show up here with a link to your
174
+ website. [[Become a sponsor](https://opencollective.com/tsed#sponsor)]
66
175
 
67
176
  ## License
68
177
 
@@ -70,8 +179,15 @@ The MIT License (MIT)
70
179
 
71
180
  Copyright (c) 2016 - 2018 Romain Lenzotti
72
181
 
73
- 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:
182
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
183
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
184
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
185
+ persons to whom the Software is furnished to do so, subject to the following conditions:
74
186
 
75
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
187
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
188
+ Software.
76
189
 
77
- 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.
190
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
191
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
192
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
193
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.