@tsed/cli 6.6.3 → 7.0.0-alpha.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.
- package/lib/esm/commands/add/AddCmd.js +16 -16
- package/lib/esm/commands/generate/GenerateCmd.js +69 -222
- package/lib/esm/commands/generate/mappers/mapGenerateContext.js +29 -0
- package/lib/esm/commands/init/InitCmd.js +190 -171
- package/lib/esm/commands/init/config/FeaturesPrompt.js +101 -3
- package/lib/esm/commands/init/mappers/mapToContext.js +4 -3
- package/lib/esm/commands/run/RunCmd.js +22 -26
- package/lib/esm/commands/update/UpdateCmd.js +9 -13
- package/lib/esm/fn/exec.js +5 -0
- package/lib/esm/fn/render.js +5 -0
- package/lib/esm/fn/taskOutput.js +7 -0
- package/lib/esm/index.js +7 -4
- package/lib/esm/interfaces/AlterPackageJson.js +1 -0
- package/lib/esm/interfaces/AlterProjectFiles.js +1 -0
- package/lib/esm/interfaces/AlterRenderFiles.js +1 -0
- package/lib/esm/interfaces/CliCommandHooks.js +1 -0
- package/lib/esm/interfaces/GenerateCmdContext.js +1 -0
- package/lib/esm/interfaces/InitCmdOptions.js +1 -0
- package/lib/esm/interfaces/RenderDataContext.js +1 -0
- package/lib/esm/interfaces/RuntimeTypes.js +1 -0
- package/lib/esm/interfaces/index.js +9 -0
- package/lib/esm/pipes/OutputFilePathPipe.js +40 -18
- package/lib/esm/pipes/RoutePipe.js +4 -8
- package/lib/esm/pipes/{ClassNamePipe.js → SymbolNamePipe.js} +14 -11
- package/lib/esm/pipes/index.js +1 -1
- package/lib/esm/platforms/{InitPlatformsModule.js → PlatformsModule.js} +4 -10
- package/lib/esm/platforms/supports/InitExpressPlatform.js +27 -10
- package/lib/esm/platforms/supports/InitFastifyPlatform.js +27 -10
- package/lib/esm/platforms/supports/InitKoaPlatform.js +16 -10
- package/lib/esm/processors/__fixtures__/createFakeProject.js +35 -0
- package/lib/esm/processors/transformBinFile.js +47 -0
- package/lib/esm/processors/transformConfigFile.js +105 -0
- package/lib/esm/processors/transformIndexFile.js +23 -0
- package/lib/esm/processors/transformServerFile.js +60 -0
- package/lib/esm/runtimes/RuntimesModule.js +7 -17
- package/lib/esm/runtimes/supports/BabelRuntime.js +5 -11
- package/lib/esm/runtimes/supports/BunRuntime.js +4 -10
- package/lib/esm/runtimes/supports/NodeRuntime.js +1 -1
- package/lib/esm/runtimes/supports/WebpackRuntime.js +1 -1
- package/lib/esm/services/CliProjectService.js +96 -0
- package/lib/esm/services/CliRunScript.js +4 -8
- package/lib/esm/services/CliTemplatesService.js +68 -0
- package/lib/esm/services/ProjectClient.js +161 -0
- package/lib/esm/services/mappers/mapDefaultTemplateOptions.js +30 -0
- package/lib/esm/templates/asyncFactory.template.js +38 -0
- package/lib/esm/templates/barrels.template.js +22 -0
- package/lib/esm/templates/command.template.js +56 -0
- package/lib/esm/templates/config.template.js +27 -0
- package/lib/esm/templates/controller.template.js +45 -0
- package/lib/esm/templates/decorator.template.js +182 -0
- package/lib/esm/templates/docker-compose.template.js +25 -0
- package/lib/esm/templates/dockerfile.template.js +236 -0
- package/lib/esm/templates/exception-filter.template.js +19 -0
- package/lib/esm/templates/factory.template.js +37 -0
- package/lib/esm/templates/index.command.template.js +18 -0
- package/lib/esm/templates/index.config.utils.template.js +17 -0
- package/{templates/init/src/controllers/pages/IndexController.ts.hbs → lib/esm/templates/index.controller.template.js} +14 -3
- package/lib/esm/templates/index.js +32 -0
- package/lib/esm/templates/index.logger.template.js +38 -0
- package/{templates/init/src/index.ts.hbs → lib/esm/templates/index.template.js} +17 -5
- package/lib/esm/templates/interceptor.template.js +31 -0
- package/lib/esm/templates/interface.template.js +13 -0
- package/lib/esm/templates/middleware.template.js +34 -0
- package/lib/esm/templates/model.template.js +16 -0
- package/lib/esm/templates/module.template.js +16 -0
- package/lib/esm/templates/pipe.template.js +19 -0
- package/lib/esm/templates/pm2.template.js +111 -0
- package/lib/esm/templates/prisma.service.template.js +23 -0
- package/{templates/init/README.md.hbs → lib/esm/templates/readme.template.js} +28 -13
- package/lib/esm/templates/repository.template.js +16 -0
- package/lib/esm/templates/response-filter.template.js +19 -0
- package/lib/esm/templates/server.template.js +37 -0
- package/lib/esm/templates/service.template.js +16 -0
- package/lib/esm/templates/tsconfig.spec.template.js +34 -0
- package/lib/esm/templates/tsconfig.template.js +31 -0
- package/lib/esm/templates/value.template.js +13 -0
- package/lib/esm/utils/defineTemplate.js +13 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/commands/add/AddCmd.d.ts +2 -2
- package/lib/types/commands/generate/GenerateCmd.d.ts +33 -87
- package/lib/types/commands/generate/mappers/mapGenerateContext.d.ts +2 -0
- package/lib/types/commands/init/InitCmd.d.ts +18 -20
- package/lib/types/commands/init/config/FeaturesPrompt.d.ts +11 -2
- package/lib/types/commands/init/mappers/mapToContext.d.ts +2 -2
- package/lib/types/commands/init/mappers/mapUniqFeatures.d.ts +1 -1
- package/lib/types/commands/init/prompts/getFeaturesPrompt.d.ts +1 -1
- package/lib/types/commands/update/UpdateCmd.d.ts +2 -2
- package/lib/types/fn/exec.d.ts +1 -0
- package/lib/types/fn/render.d.ts +2 -0
- package/lib/types/fn/taskOutput.d.ts +1 -0
- package/lib/types/index.d.ts +7 -4
- package/lib/types/interfaces/AlterGenerateTasks.d.ts +5 -0
- package/lib/types/interfaces/AlterInitSubTasks.d.ts +5 -0
- package/lib/types/interfaces/AlterPackageJson.d.ts +5 -0
- package/lib/types/interfaces/AlterProjectFiles.d.ts +5 -0
- package/lib/types/interfaces/AlterRenderFiles.d.ts +10 -0
- package/lib/types/interfaces/CliCommandHooks.d.ts +11 -0
- package/lib/types/interfaces/GenerateCmdContext.d.ts +19 -0
- package/lib/types/interfaces/InitCmdOptions.d.ts +8 -0
- package/lib/types/interfaces/PlatformType.d.ts +7 -0
- package/lib/types/interfaces/RenderDataContext.d.ts +61 -0
- package/lib/types/interfaces/RuntimeTypes.d.ts +8 -0
- package/lib/types/interfaces/index.d.ts +9 -0
- package/lib/types/pipes/OutputFilePathPipe.d.ts +7 -4
- package/lib/types/pipes/{ClassNamePipe.d.ts → SymbolNamePipe.d.ts} +3 -3
- package/lib/types/pipes/index.d.ts +1 -1
- package/lib/types/platforms/{InitPlatformsModule.d.ts → PlatformsModule.d.ts} +1 -1
- package/lib/types/platforms/supports/InitBasePlatform.d.ts +3 -0
- package/lib/types/platforms/supports/InitExpressPlatform.d.ts +2 -0
- package/lib/types/platforms/supports/InitFastifyPlatform.d.ts +2 -0
- package/lib/types/platforms/supports/InitKoaPlatform.d.ts +2 -0
- package/lib/types/processors/__fixtures__/createFakeProject.d.ts +5 -0
- package/lib/types/processors/transformBinFile.d.ts +3 -0
- package/lib/types/processors/transformConfigFile.d.ts +3 -0
- package/lib/types/processors/transformIndexFile.d.ts +3 -0
- package/lib/types/processors/transformServerFile.d.ts +3 -0
- package/lib/types/runtimes/RuntimesModule.d.ts +5 -5
- package/lib/types/services/CliProjectService.d.ts +16 -0
- package/lib/types/services/CliTemplatesService.d.ts +29 -0
- package/lib/types/services/ProjectClient.d.ts +40 -0
- package/lib/types/services/mappers/mapDefaultTemplateOptions.d.ts +11 -0
- package/lib/types/templates/asyncFactory.template.d.ts +2 -0
- package/lib/types/templates/barrels.template.d.ts +2 -0
- package/lib/types/templates/command.template.d.ts +2 -0
- package/lib/types/templates/config.template.d.ts +2 -0
- package/lib/types/templates/controller.template.d.ts +2 -0
- package/lib/types/templates/decorator.template.d.ts +2 -0
- package/lib/types/templates/docker-compose.template.d.ts +2 -0
- package/lib/types/templates/dockerfile.template.d.ts +1 -0
- package/lib/types/templates/exception-filter.template.d.ts +2 -0
- package/lib/types/templates/factory.template.d.ts +2 -0
- package/lib/types/templates/index.command.template.d.ts +2 -0
- package/lib/types/templates/index.config.utils.template.d.ts +2 -0
- package/lib/types/templates/index.controller.template.d.ts +2 -0
- package/lib/types/templates/index.d.ts +31 -0
- package/lib/types/templates/index.logger.template.d.ts +2 -0
- package/lib/types/templates/index.template.d.ts +2 -0
- package/lib/types/templates/interceptor.template.d.ts +2 -0
- package/lib/types/templates/interface.template.d.ts +2 -0
- package/lib/types/templates/middleware.template.d.ts +2 -0
- package/lib/types/templates/model.template.d.ts +2 -0
- package/lib/types/templates/module.template.d.ts +2 -0
- package/lib/types/templates/pipe.template.d.ts +2 -0
- package/lib/types/templates/pm2.template.d.ts +1 -0
- package/lib/types/templates/prisma.service.template.d.ts +2 -0
- package/lib/types/templates/readme.template.d.ts +2 -0
- package/lib/types/templates/repository.template.d.ts +2 -0
- package/lib/types/templates/response-filter.template.d.ts +2 -0
- package/lib/types/templates/server.template.d.ts +2 -0
- package/lib/types/templates/service.template.d.ts +2 -0
- package/lib/types/templates/tsconfig.spec.template.d.ts +2 -0
- package/lib/types/templates/tsconfig.template.d.ts +2 -0
- package/lib/types/templates/value.template.d.ts +2 -0
- package/lib/types/utils/defineTemplate.d.ts +39 -0
- package/package.json +14 -12
- package/templates/tsconfig.node.json +14 -0
- package/templates/webpack.config.js +55 -0
- package/lib/esm/commands/generate/ProviderTypes.js +0 -103
- package/lib/esm/commands/init/interfaces/InitOptions.js +0 -5
- package/lib/esm/services/ProvidersInfoService.js +0 -46
- package/lib/esm/services/Renderer.js +0 -162
- package/lib/esm/utils/fillImports.js +0 -38
- package/lib/esm/utils/hbs/array.js +0 -515
- package/lib/esm/utils/hbs/collection.js +0 -60
- package/lib/esm/utils/hbs/comparison.js +0 -431
- package/lib/esm/utils/hbs/index.js +0 -11
- package/lib/esm/utils/hbs/object.js +0 -236
- package/lib/esm/utils/hbs/switch.js +0 -10
- package/lib/esm/utils/renderer/insertAfter.js +0 -12
- package/lib/esm/utils/renderer/insertImport.js +0 -11
- package/lib/types/commands/generate/ProviderTypes.d.ts +0 -11
- package/lib/types/commands/init/interfaces/InitCmdContext.d.ts +0 -6
- package/lib/types/commands/init/interfaces/InitOptions.d.ts +0 -20
- package/lib/types/services/ProvidersInfoService.d.ts +0 -21
- package/lib/types/services/Renderer.d.ts +0 -44
- package/lib/types/utils/fillImports.d.ts +0 -1
- package/lib/types/utils/hbs/array.d.ts +0 -1
- package/lib/types/utils/hbs/collection.d.ts +0 -1
- package/lib/types/utils/hbs/comparison.d.ts +0 -1
- package/lib/types/utils/hbs/object.d.ts +0 -1
- package/lib/types/utils/hbs/switch.d.ts +0 -1
- package/lib/types/utils/renderer/insertAfter.d.ts +0 -1
- package/lib/types/utils/renderer/insertImport.d.ts +0 -1
- package/templates/generate/async.factory.hbs +0 -35
- package/templates/generate/command.hbs +0 -45
- package/templates/generate/controller.hbs +0 -10
- package/templates/generate/decorator.class.hbs +0 -14
- package/templates/generate/decorator.endpoint.hbs +0 -15
- package/templates/generate/decorator.generic.hbs +0 -19
- package/templates/generate/decorator.method.hbs +0 -16
- package/templates/generate/decorator.middleware.hbs +0 -26
- package/templates/generate/decorator.param.hbs +0 -15
- package/templates/generate/decorator.parameters.hbs +0 -9
- package/templates/generate/decorator.prop.hbs +0 -14
- package/templates/generate/decorator.property.hbs +0 -5
- package/templates/generate/exception-filter.hbs +0 -9
- package/templates/generate/factory.hbs +0 -11
- package/templates/generate/injectable.hbs +0 -6
- package/templates/generate/interceptor.hbs +0 -21
- package/templates/generate/interface.hbs +0 -3
- package/templates/generate/middleware.hbs +0 -9
- package/templates/generate/model.hbs +0 -6
- package/templates/generate/module.hbs +0 -6
- package/templates/generate/pipe.hbs +0 -9
- package/templates/generate/prisma.service.hbs +0 -13
- package/templates/generate/repository.hbs +0 -6
- package/templates/generate/response-filter.hbs +0 -9
- package/templates/generate/server/_partials/server-footer.hbs +0 -10
- package/templates/generate/server/_partials/server-header.hbs +0 -34
- package/templates/generate/server/express/server.hbs +0 -10
- package/templates/generate/server/fastify/server.hbs +0 -14
- package/templates/generate/server/koa/server.hbs +0 -8
- package/templates/generate/service.hbs +0 -6
- package/templates/generate/value.hbs +0 -3
- package/templates/init/.barrels.json.hbs +0 -9
- package/templates/init/.gitignore.hbs +0 -57
- package/templates/init/.npmrc.hbs +0 -2
- package/templates/init/docker/_partials/docker-body.hbs +0 -5
- package/templates/init/docker/_partials/docker-dev-tools.hbs +0 -2
- package/templates/init/docker/_partials/docker-header.hbs +0 -16
- package/templates/init/docker/bun/Dockerfile.hbs +0 -36
- package/templates/init/docker/npm/Dockerfile.hbs +0 -28
- package/templates/init/docker/pnpm/Dockerfile.hbs +0 -28
- package/templates/init/docker/yarn/Dockerfile.hbs +0 -28
- package/templates/init/docker/yarn_berry/Dockerfile.hbs +0 -31
- package/templates/init/docker-compose.yml.hbs +0 -14
- package/templates/init/pm2/bun/processes.config.cjs.hbs +0 -23
- package/templates/init/pm2/node-compiled/processes.config.cjs.hbs +0 -22
- package/templates/init/pm2/node-loader/processes.config.cjs.hbs +0 -24
- package/templates/init/src/bin/index.ts.hbs +0 -9
- package/templates/init/src/config/envs/index.ts.hbs +0 -7
- package/templates/init/src/config/index.ts.hbs +0 -38
- package/templates/init/src/config/logger/index.ts.hbs +0 -25
- package/templates/init/tsconfig.json.hbs +0 -16
- package/templates/init/tsconfig.node.json.hbs +0 -20
- package/templates/init/tsconfig.spec.json.hbs +0 -25
- package/templates/init/webpack.config.js.hbs +0 -65
- /package/lib/esm/{commands/init/interfaces/InitCmdContext.js → interfaces/AlterGenerateTasks.js} +0 -0
- /package/lib/{types/utils/hbs/index.d.ts → esm/interfaces/AlterInitSubTasks.js} +0 -0
- /package/templates/{init/.babelrc.hbs → .babelrc} +0 -0
- /package/templates/{init/.dockerignore.hbs → .dockerignore} +0 -0
- /package/templates/{init/.swcrc.hbs → .swcrc} +0 -0
- /package/templates/{init/.yarnrc.hbs → .yarnrc} +0 -0
- /package/templates/{init/nodemon.json.hbs → nodemon.json} +0 -0
- /package/templates/{init/tsconfig.base.json.hbs → tsconfig.base.json} +0 -0
- /package/templates/{init/views/swagger.ejs.hbs → views/swagger.ejs} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface AddCmdOptions extends
|
|
1
|
+
import { CliPlugins, type CommandProvider, PackageManagersModule, ProjectPackageJson, type QuestionOptions, type Task } from "@tsed/cli-core";
|
|
2
|
+
export interface AddCmdOptions extends CommandProvider {
|
|
3
3
|
name: string;
|
|
4
4
|
}
|
|
5
5
|
export declare class AddCmd implements CommandProvider {
|
|
@@ -1,101 +1,47 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { RoutePipe } from "../../pipes/RoutePipe.js";
|
|
7
|
-
import { ProvidersInfoService } from "../../services/ProvidersInfoService.js";
|
|
8
|
-
import { SrcRendererService } from "../../services/Renderer.js";
|
|
9
|
-
export interface GenerateCmdContext extends CliDefaultOptions {
|
|
10
|
-
type: string;
|
|
11
|
-
name: string;
|
|
12
|
-
route: string;
|
|
13
|
-
directory: string;
|
|
14
|
-
platform: PlatformType;
|
|
15
|
-
templateType: string;
|
|
16
|
-
middlewarePosition: "before" | "after";
|
|
17
|
-
symbolName: string;
|
|
18
|
-
symbolPath: string;
|
|
19
|
-
symbolPathBasename: string;
|
|
20
|
-
convention: ProjectConvention;
|
|
21
|
-
}
|
|
1
|
+
import { type CommandProvider, ProjectPackageJson, type Task } from "@tsed/cli-core";
|
|
2
|
+
import type { GenerateCmdContext } from "../../interfaces/GenerateCmdContext.js";
|
|
3
|
+
import { CliProjectService } from "../../services/CliProjectService.js";
|
|
4
|
+
import { CliTemplatesService } from "../../services/CliTemplatesService.js";
|
|
5
|
+
import type { DefineTemplateOptions } from "../../utils/defineTemplate.js";
|
|
22
6
|
export declare class GenerateCmd implements CommandProvider {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
7
|
+
protected projectPackageJson: ProjectPackageJson;
|
|
8
|
+
protected projectService: CliProjectService;
|
|
9
|
+
protected templates: CliTemplatesService;
|
|
10
|
+
$prompt(data: Partial<GenerateCmdContext>): Promise<(import("inquirer").NumberQuestion<GenerateCmdContext> | import("inquirer").InputQuestion<GenerateCmdContext> | import("inquirer").PasswordQuestion<GenerateCmdContext> | import("inquirer").ListQuestion<GenerateCmdContext> | import("inquirer").RawListQuestion<GenerateCmdContext> | import("inquirer").ExpandQuestion<GenerateCmdContext> | import("inquirer").CheckboxQuestion<GenerateCmdContext> | import("inquirer").ConfirmQuestion<GenerateCmdContext> | import("inquirer").EditorQuestion<GenerateCmdContext> | import("inquirer-autocomplete-prompt").default.AutocompleteQuestionOptions<GenerateCmdContext> | readonly import("inquirer").DistinctQuestion<GenerateCmdContext>[] | import("rxjs").Observable<import("inquirer").DistinctQuestion<GenerateCmdContext>> | {
|
|
11
|
+
[x: string]: (import("inquirer").NumberQuestion<GenerateCmdContext> & {
|
|
12
|
+
name?: never;
|
|
13
|
+
}) | (import("inquirer").InputQuestion<GenerateCmdContext> & {
|
|
14
|
+
name?: never;
|
|
15
|
+
}) | (import("inquirer").PasswordQuestion<GenerateCmdContext> & {
|
|
16
|
+
name?: never;
|
|
17
|
+
}) | (import("inquirer").ListQuestion<GenerateCmdContext> & {
|
|
18
|
+
name?: never;
|
|
19
|
+
}) | (import("inquirer").RawListQuestion<GenerateCmdContext> & {
|
|
20
|
+
name?: never;
|
|
21
|
+
}) | (import("inquirer").ExpandQuestion<GenerateCmdContext> & {
|
|
22
|
+
name?: never;
|
|
23
|
+
}) | (import("inquirer").CheckboxQuestion<GenerateCmdContext> & {
|
|
24
|
+
name?: never;
|
|
25
|
+
}) | (import("inquirer").ConfirmQuestion<GenerateCmdContext> & {
|
|
26
|
+
name?: never;
|
|
27
|
+
}) | (import("inquirer").EditorQuestion<GenerateCmdContext> & {
|
|
28
|
+
name?: never;
|
|
29
|
+
}) | undefined;
|
|
30
|
+
} | {
|
|
31
31
|
type: string;
|
|
32
32
|
name: string;
|
|
33
33
|
message: string;
|
|
34
34
|
default: string | undefined;
|
|
35
35
|
when: () => boolean;
|
|
36
|
-
source: (
|
|
37
|
-
choices?: undefined;
|
|
36
|
+
source: (_: any, keyword: string) => DefineTemplateOptions[];
|
|
38
37
|
} | {
|
|
39
38
|
type: string;
|
|
40
39
|
name: string;
|
|
41
40
|
message: string;
|
|
42
|
-
default: (state:
|
|
41
|
+
default: (state: Partial<GenerateCmdContext>) => string;
|
|
43
42
|
when: boolean;
|
|
44
43
|
source?: undefined;
|
|
45
|
-
|
|
46
|
-
} | {
|
|
47
|
-
message: string;
|
|
48
|
-
type: string;
|
|
49
|
-
name: string;
|
|
50
|
-
when(state: any): boolean;
|
|
51
|
-
choices: any[];
|
|
52
|
-
default?: undefined;
|
|
53
|
-
source?: undefined;
|
|
54
|
-
} | {
|
|
55
|
-
type: string;
|
|
56
|
-
name: string;
|
|
57
|
-
message: string;
|
|
58
|
-
when(state: any): boolean;
|
|
59
|
-
default: (state: GenerateCmdContext) => string;
|
|
60
|
-
source?: undefined;
|
|
61
|
-
choices?: undefined;
|
|
62
|
-
} | {
|
|
63
|
-
type: string;
|
|
64
|
-
name: string;
|
|
65
|
-
message: string;
|
|
66
|
-
when(state: any): string | true | undefined;
|
|
67
|
-
choices: string[];
|
|
68
|
-
default?: undefined;
|
|
69
|
-
source?: undefined;
|
|
70
|
-
} | {
|
|
71
|
-
type: string;
|
|
72
|
-
name: string;
|
|
73
|
-
message: (state: any) => string;
|
|
74
|
-
when(state: any): boolean;
|
|
75
|
-
source: (state: any, keyword: string) => any;
|
|
76
|
-
default?: undefined;
|
|
77
|
-
choices?: undefined;
|
|
78
|
-
} | {
|
|
79
|
-
type: string;
|
|
80
|
-
name: string;
|
|
81
|
-
message: () => string;
|
|
82
|
-
choices: {
|
|
83
|
-
name: string;
|
|
84
|
-
value: string;
|
|
85
|
-
}[];
|
|
86
|
-
when(state: any): boolean;
|
|
87
|
-
default?: undefined;
|
|
88
|
-
source?: undefined;
|
|
89
|
-
})[];
|
|
44
|
+
})[]>;
|
|
90
45
|
$mapContext(ctx: Partial<GenerateCmdContext>): GenerateCmdContext;
|
|
91
|
-
$exec(ctx: GenerateCmdContext):
|
|
92
|
-
title: string;
|
|
93
|
-
task: () => Promise<void>;
|
|
94
|
-
skip?: undefined;
|
|
95
|
-
} | {
|
|
96
|
-
title: string;
|
|
97
|
-
skip(): boolean;
|
|
98
|
-
task: () => Promise<void>;
|
|
99
|
-
})[];
|
|
100
|
-
getDirectories(dir: string): string[];
|
|
46
|
+
$exec(ctx: GenerateCmdContext): Task[];
|
|
101
47
|
}
|
|
@@ -1,38 +1,36 @@
|
|
|
1
|
-
import { CliExeca, CliFs, CliLoadFile, CliPlugins,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { CliExeca, CliFs, CliLoadFile, CliPlugins, type CommandProvider, PackageManagersModule, ProjectPackageJson, type QuestionOptions, type Task } from "@tsed/cli-core";
|
|
2
|
+
import { type InitCmdContext } from "../../interfaces/index.js";
|
|
3
|
+
import type { InitOptions } from "../../interfaces/InitCmdOptions.js";
|
|
4
|
+
import { PlatformsModule } from "../../platforms/PlatformsModule.js";
|
|
4
5
|
import { RuntimesModule } from "../../runtimes/RuntimesModule.js";
|
|
5
|
-
import {
|
|
6
|
-
import type { InitCmdContext } from "./interfaces/InitCmdContext.js";
|
|
7
|
-
import type { InitOptions } from "./interfaces/InitOptions.js";
|
|
6
|
+
import { CliProjectService } from "../../services/CliProjectService.js";
|
|
8
7
|
export declare class InitCmd implements CommandProvider {
|
|
9
8
|
protected configuration: any;
|
|
10
9
|
protected cliPlugins: CliPlugins;
|
|
11
10
|
protected packageJson: ProjectPackageJson;
|
|
12
11
|
protected packageManagers: PackageManagersModule;
|
|
13
12
|
protected runtimes: RuntimesModule;
|
|
14
|
-
protected platforms:
|
|
13
|
+
protected platforms: PlatformsModule;
|
|
15
14
|
protected cliPackageJson: import("@tsed/cli-core").PackageJson;
|
|
16
|
-
protected cliService: CliService;
|
|
17
15
|
protected cliLoadFile: CliLoadFile;
|
|
18
|
-
protected
|
|
19
|
-
protected outputFilePathPipe: OutputFilePathPipe;
|
|
16
|
+
protected project: CliProjectService;
|
|
20
17
|
protected execa: CliExeca;
|
|
21
18
|
protected fs: CliFs;
|
|
22
|
-
checkPrecondition(ctx:
|
|
19
|
+
checkPrecondition(ctx: InitOptions): void;
|
|
23
20
|
$beforePrompt(initialOptions: Partial<InitOptions>): Promise<any>;
|
|
24
21
|
$prompt(initialOptions: Partial<InitOptions>): QuestionOptions;
|
|
25
|
-
$mapContext(ctx: any):
|
|
26
|
-
$beforeExec(ctx:
|
|
27
|
-
$exec(ctx:
|
|
22
|
+
$mapContext(ctx: any): InitOptions;
|
|
23
|
+
$beforeExec(ctx: InitOptions): Promise<any>;
|
|
24
|
+
$exec(ctx: InitOptions): Promise<Task[]>;
|
|
28
25
|
$afterPostInstall(): {
|
|
29
26
|
title: string;
|
|
30
27
|
task: () => import("rxjs").Observable<unknown>;
|
|
31
28
|
}[];
|
|
32
|
-
resolveRootDir(ctx: Partial<
|
|
33
|
-
addScripts(ctx:
|
|
34
|
-
addDependencies(ctx:
|
|
35
|
-
addDevDependencies(ctx:
|
|
36
|
-
addFeatures(ctx:
|
|
37
|
-
|
|
29
|
+
resolveRootDir(ctx: Partial<InitOptions>): void;
|
|
30
|
+
addScripts(ctx: InitOptions): void;
|
|
31
|
+
addDependencies(ctx: InitOptions): void;
|
|
32
|
+
addDevDependencies(ctx: InitOptions): void;
|
|
33
|
+
addFeatures(ctx: InitOptions): void;
|
|
34
|
+
baseFiles(ctx: InitCmdContext): Promise<void>;
|
|
35
|
+
renderFiles(ctx: InitOptions): Promise<void>;
|
|
38
36
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { PlatformType } from "../../../interfaces/index.js";
|
|
2
|
-
import type { InitOptions } from "../interfaces/InitOptions.js";
|
|
1
|
+
import { type InitOptions, PlatformType } from "../../../interfaces/index.js";
|
|
3
2
|
export interface Feature {
|
|
4
3
|
name: string;
|
|
5
4
|
value?: any;
|
|
@@ -13,9 +12,19 @@ export declare enum FeatureType {
|
|
|
13
12
|
SOCKETIO = "socketio",
|
|
14
13
|
OIDC = "oidc",
|
|
15
14
|
PASSPORTJS = "passportjs",
|
|
15
|
+
CONFIG = "config",
|
|
16
16
|
COMMANDS = "commands",
|
|
17
17
|
DB = "db",
|
|
18
18
|
DOC = "doc",
|
|
19
|
+
CONFIG_ENVS = "config:envs",
|
|
20
|
+
CONFIG_DOTENV = "config:dotenv",
|
|
21
|
+
CONFIG_JSON = "config:json",
|
|
22
|
+
CONFIG_YAML = "config:yaml",
|
|
23
|
+
CONFIG_AWS_SECRETS = "config:aws_secrets",
|
|
24
|
+
CONFIG_IOREDIS = "config:ioredis",
|
|
25
|
+
CONFIG_MONGO = "config:mongo",
|
|
26
|
+
CONFIG_VAULT = "config:vault",
|
|
27
|
+
CONFIG_POSTGRES = "config:postgres",
|
|
19
28
|
SWAGGER = "swagger",
|
|
20
29
|
SCALAR = "scalar",
|
|
21
30
|
PRISMA = "prisma",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function mapToContext(options: any):
|
|
1
|
+
import type { InitOptions } from "../../../interfaces/InitCmdOptions.js";
|
|
2
|
+
export declare function mapToContext(options: any): InitOptions;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { InitOptions } from "
|
|
1
|
+
import type { InitOptions } from "../../../interfaces/InitCmdOptions.js";
|
|
2
2
|
import type { InitPromptAnswers } from "../interfaces/InitPromptAnswers.js";
|
|
3
3
|
export declare function mapUniqFeatures(answers: InitPromptAnswers & any): InitOptions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InitOptions } from "
|
|
1
|
+
import type { InitOptions } from "../../../interfaces/index.js";
|
|
2
2
|
export declare function getFeaturesPrompt(runtimes: string[], availablePackageManagers: string[], options: Partial<InitOptions>): any[];
|
|
3
3
|
export declare function getFrameworksPrompt(): {
|
|
4
4
|
choices: any[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export interface UpdateCmdContext extends
|
|
1
|
+
import { type CommandData, type CommandProvider, NpmRegistryClient, PackageManagersModule, ProjectPackageJson, type QuestionOptions, type Task } from "@tsed/cli-core";
|
|
2
|
+
export interface UpdateCmdContext extends CommandData {
|
|
3
3
|
version: string;
|
|
4
4
|
[key: string]: any;
|
|
5
5
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function exec(command: string, data: any): Promise<import("@tsed/cli-core").Task[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function taskOutput(output: string): void;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import "./templates/index.js";
|
|
1
2
|
export * from "./Cli.js";
|
|
2
3
|
export * from "./commands/add/AddCmd.js";
|
|
3
4
|
export * from "./commands/generate/GenerateCmd.js";
|
|
4
5
|
export * from "./commands/init/config/FeaturesPrompt.js";
|
|
5
6
|
export * from "./commands/init/config/FeaturesPrompt.js";
|
|
6
7
|
export * from "./commands/init/InitCmd.js";
|
|
7
|
-
export * from "./commands/init/interfaces/InitCmdContext.js";
|
|
8
|
-
export * from "./commands/init/interfaces/InitOptions.js";
|
|
9
8
|
export * from "./commands/init/prompts/getFeaturesPrompt.js";
|
|
10
9
|
export * from "./commands/update/UpdateCmd.js";
|
|
11
10
|
export * from "./constants/index.js";
|
|
11
|
+
export * from "./fn/exec.js";
|
|
12
|
+
export * from "./fn/render.js";
|
|
12
13
|
export * from "./interfaces/index.js";
|
|
13
14
|
export * from "./pipes/index.js";
|
|
14
15
|
export * from "./runtimes/index.js";
|
|
15
|
-
export * from "./services/
|
|
16
|
-
export * from "./services/
|
|
16
|
+
export * from "./services/CliProjectService.js";
|
|
17
|
+
export * from "./services/CliTemplatesService.js";
|
|
18
|
+
export * from "./services/ProjectClient.js";
|
|
19
|
+
export * from "./utils/defineTemplate.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ProjectPackageJson } from "@tsed/cli-core";
|
|
2
|
+
import type { RenderDataContext } from "./RenderDataContext.js";
|
|
3
|
+
export interface AlterPackageJson {
|
|
4
|
+
$alterPackageJson(packageJson: ProjectPackageJson, data: RenderDataContext): ProjectPackageJson | Promise<ProjectPackageJson>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ProjectClient } from "../services/ProjectClient.js";
|
|
2
|
+
import type { RenderDataContext } from "./RenderDataContext.js";
|
|
3
|
+
export interface AlterProjectFiles {
|
|
4
|
+
$alterProjectFiles(project: ProjectClient, data: RenderDataContext): ProjectClient | Promise<ProjectClient>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RenderDataContext } from "./RenderDataContext.js";
|
|
2
|
+
export interface AlterRenderFiles {
|
|
3
|
+
$alterRenderFiles(files: string[], data: RenderDataContext): (string | {
|
|
4
|
+
id: string;
|
|
5
|
+
from: string;
|
|
6
|
+
})[] | Promise<(string | {
|
|
7
|
+
id: string;
|
|
8
|
+
from: string;
|
|
9
|
+
})[]>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Task } from "@tsed/cli-core";
|
|
2
|
+
import type { AlterGenerateTasks } from "./AlterGenerateTasks.js";
|
|
3
|
+
import type { AlterInitSubTasks } from "./AlterInitSubTasks.js";
|
|
4
|
+
import type { AlterPackageJson } from "./AlterPackageJson.js";
|
|
5
|
+
import type { AlterProjectFiles } from "./AlterProjectFiles.js";
|
|
6
|
+
import type { AlterRenderFiles } from "./AlterRenderFiles.js";
|
|
7
|
+
import type { InitCmdContext } from "./InitCmdOptions.js";
|
|
8
|
+
export interface CliCommandHooks extends Partial<AlterInitSubTasks & AlterPackageJson & AlterRenderFiles & AlterProjectFiles & AlterGenerateTasks> {
|
|
9
|
+
$alterInitPostInstallTasks?(tasks: Task[], data: InitCmdContext): Task[] | Promise<Task[]>;
|
|
10
|
+
$alterGeneratePostInstallTasks?(tasks: Task[], data: InitCmdContext): Task[] | Promise<Task[]>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RenderDataContext } from "./RenderDataContext.js";
|
|
2
|
+
declare global {
|
|
3
|
+
namespace TsED {
|
|
4
|
+
interface GenerateOptions {
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export interface GenerateCmdContext extends RenderDataContext, TsED.GenerateOptions {
|
|
9
|
+
type: string;
|
|
10
|
+
name: string;
|
|
11
|
+
route: string;
|
|
12
|
+
directory: string;
|
|
13
|
+
templateType: string;
|
|
14
|
+
middlewarePosition: "before" | "after";
|
|
15
|
+
symbolName: string;
|
|
16
|
+
symbolPath: string;
|
|
17
|
+
symbolPathBasename: string;
|
|
18
|
+
getName: (state: Partial<GenerateCmdContext>) => string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type CommandData, PackageManager } from "@tsed/cli-core";
|
|
2
|
+
import type { FeatureType } from "../commands/init/config/FeaturesPrompt.js";
|
|
3
|
+
import type { ArchitectureConvention } from "./ArchitectureConvention.js";
|
|
4
|
+
import type { PlatformType } from "./PlatformType.js";
|
|
5
|
+
import type { ProjectConvention } from "./ProjectConvention.js";
|
|
6
|
+
import type { RuntimeTypes } from "./RuntimeTypes.js";
|
|
7
|
+
declare global {
|
|
8
|
+
namespace TsED {
|
|
9
|
+
interface RenderDataContext {
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export interface RenderDataContext extends CommandData, TsED.RenderDataContext {
|
|
14
|
+
commandName: string;
|
|
15
|
+
platform: PlatformType;
|
|
16
|
+
convention: ProjectConvention;
|
|
17
|
+
packageManager: PackageManager;
|
|
18
|
+
architecture: ArchitectureConvention;
|
|
19
|
+
runtime: RuntimeTypes;
|
|
20
|
+
features?: FeatureType[];
|
|
21
|
+
root?: string;
|
|
22
|
+
projectName?: string;
|
|
23
|
+
tsedVersion?: string;
|
|
24
|
+
cliVersion?: string;
|
|
25
|
+
oidcBasePath?: string;
|
|
26
|
+
file?: string;
|
|
27
|
+
route: string;
|
|
28
|
+
express?: boolean;
|
|
29
|
+
koa?: boolean;
|
|
30
|
+
fastify?: boolean;
|
|
31
|
+
swagger?: boolean;
|
|
32
|
+
oidc?: boolean;
|
|
33
|
+
graphql?: boolean;
|
|
34
|
+
scalar?: boolean;
|
|
35
|
+
mongoose?: boolean;
|
|
36
|
+
typeorm?: boolean;
|
|
37
|
+
passportjs?: boolean;
|
|
38
|
+
config?: boolean;
|
|
39
|
+
configEnvs?: boolean;
|
|
40
|
+
configDotenv?: boolean;
|
|
41
|
+
configJson?: boolean;
|
|
42
|
+
configYaml?: boolean;
|
|
43
|
+
configIoredis?: boolean;
|
|
44
|
+
configMongo?: boolean;
|
|
45
|
+
configAwsSecrets?: boolean;
|
|
46
|
+
configVault?: boolean;
|
|
47
|
+
configPostgres?: boolean;
|
|
48
|
+
barrels?: string;
|
|
49
|
+
bun?: boolean;
|
|
50
|
+
node?: boolean;
|
|
51
|
+
compiled?: boolean;
|
|
52
|
+
testing?: boolean;
|
|
53
|
+
commands?: boolean;
|
|
54
|
+
eslint?: boolean;
|
|
55
|
+
jest?: boolean;
|
|
56
|
+
prettier?: boolean;
|
|
57
|
+
vitest?: boolean;
|
|
58
|
+
lintstaged?: boolean;
|
|
59
|
+
prisma?: boolean;
|
|
60
|
+
passport?: boolean;
|
|
61
|
+
}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
export * from "./AlterGenerateTasks.js";
|
|
2
|
+
export * from "./AlterInitSubTasks.js";
|
|
3
|
+
export * from "./AlterPackageJson.js";
|
|
4
|
+
export * from "./AlterProjectFiles.js";
|
|
5
|
+
export * from "./AlterRenderFiles.js";
|
|
1
6
|
export * from "./ArchitectureConvention.js";
|
|
7
|
+
export * from "./CliCommandHooks.js";
|
|
8
|
+
export * from "./GenerateCmdContext.js";
|
|
9
|
+
export * from "./InitCmdOptions.js";
|
|
2
10
|
export * from "./PlatformType.js";
|
|
3
11
|
export * from "./ProjectConvention.js";
|
|
12
|
+
export * from "./RenderDataContext.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ProjectPackageJson } from "@tsed/cli-core";
|
|
2
2
|
import { ProjectConvention } from "../interfaces/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { CliTemplatesService } from "../services/CliTemplatesService.js";
|
|
4
|
+
import { SymbolNamePipe } from "./SymbolNamePipe.js";
|
|
5
5
|
export declare class OutputFilePathPipe {
|
|
6
|
-
protected
|
|
6
|
+
protected templatesService: CliTemplatesService;
|
|
7
7
|
protected projectPackageJson: ProjectPackageJson;
|
|
8
|
-
protected classNamePipe:
|
|
8
|
+
protected classNamePipe: SymbolNamePipe;
|
|
9
9
|
transform(options: {
|
|
10
10
|
name: string;
|
|
11
11
|
type: string;
|
|
@@ -13,4 +13,7 @@ export declare class OutputFilePathPipe {
|
|
|
13
13
|
baseDir?: string;
|
|
14
14
|
format?: ProjectConvention;
|
|
15
15
|
}): string;
|
|
16
|
+
private getBaseDir;
|
|
17
|
+
getServerName(): string;
|
|
18
|
+
getIndexControllerName(): string;
|
|
16
19
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ProjectPackageJson } from "@tsed/cli-core";
|
|
2
2
|
import { ProjectConvention } from "../interfaces/ProjectConvention.js";
|
|
3
|
-
import {
|
|
4
|
-
export declare class
|
|
5
|
-
protected providers: ProvidersInfoService;
|
|
3
|
+
import { CliTemplatesService } from "../services/CliTemplatesService.js";
|
|
4
|
+
export declare class SymbolNamePipe {
|
|
6
5
|
protected projectPackageJson: ProjectPackageJson;
|
|
6
|
+
protected templates: CliTemplatesService;
|
|
7
7
|
transform(options: {
|
|
8
8
|
name: string;
|
|
9
9
|
type: string;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type { RenderDataContext } from "../../interfaces/RenderDataContext.js";
|
|
2
|
+
import type { ProjectClient } from "../../services/ProjectClient.js";
|
|
1
3
|
export interface InitBasePlatform {
|
|
2
4
|
readonly name: string;
|
|
5
|
+
alterProjectFiles(project: ProjectClient, ctx: RenderDataContext): void;
|
|
3
6
|
dependencies(ctx: any): Record<string, string>;
|
|
4
7
|
devDependencies(ctx: any): Record<string, string>;
|
|
5
8
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { ProjectClient } from "../../services/ProjectClient.js";
|
|
1
2
|
import type { InitBasePlatform } from "./InitBasePlatform.js";
|
|
2
3
|
export declare class InitExpressPlatform implements InitBasePlatform {
|
|
3
4
|
readonly name = "express";
|
|
5
|
+
alterProjectFiles(project: ProjectClient): void;
|
|
4
6
|
dependencies(ctx: any): {
|
|
5
7
|
"@tsed/platform-express": any;
|
|
6
8
|
"body-parser": string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { ProjectClient } from "../../services/ProjectClient.js";
|
|
1
2
|
import type { InitBasePlatform } from "./InitBasePlatform.js";
|
|
2
3
|
export declare class InitFastifyPlatform implements InitBasePlatform {
|
|
3
4
|
readonly name = "fastify";
|
|
5
|
+
alterProjectFiles(project: ProjectClient): void;
|
|
4
6
|
dependencies(ctx: any): {
|
|
5
7
|
"@tsed/platform-fastify": any;
|
|
6
8
|
"@fastify/accepts": string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { ProjectClient } from "../../services/ProjectClient.js";
|
|
1
2
|
import type { InitBasePlatform } from "./InitBasePlatform.js";
|
|
2
3
|
export declare class InitKoaPlatform implements InitBasePlatform {
|
|
3
4
|
readonly name = "koa";
|
|
5
|
+
alterProjectFiles(project: ProjectClient): void;
|
|
4
6
|
dependencies(ctx: any): {
|
|
5
7
|
"@tsed/platform-koa": any;
|
|
6
8
|
koa: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProjectPackageJson } from "@tsed/cli-core";
|
|
2
2
|
import { BaseRuntime } from "./supports/BaseRuntime.js";
|
|
3
|
-
export interface RuntimeInitOptions
|
|
3
|
+
export interface RuntimeInitOptions {
|
|
4
4
|
runtime?: string;
|
|
5
|
+
packageManager?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare class RuntimesModule {
|
|
7
|
-
protected runtimes: BaseRuntime[];
|
|
8
8
|
protected projectPackageJson: ProjectPackageJson;
|
|
9
|
-
|
|
10
|
-
constructor(
|
|
9
|
+
private runtimes;
|
|
10
|
+
constructor();
|
|
11
11
|
init(ctx: RuntimeInitOptions): void;
|
|
12
12
|
list(): string[];
|
|
13
13
|
get(name?: string): BaseRuntime;
|