@tsed/cli 6.6.3 → 7.0.0-alpha.10

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 (259) hide show
  1. package/lib/esm/bin/tsed.js +23 -2
  2. package/lib/esm/commands/add/AddCmd.js +16 -16
  3. package/lib/esm/commands/generate/GenerateCmd.js +72 -224
  4. package/lib/esm/commands/generate/mappers/mapGenerateContext.js +29 -0
  5. package/lib/esm/commands/index.js +2 -1
  6. package/lib/esm/commands/init/InitCmd.js +193 -172
  7. package/lib/esm/commands/init/config/FeaturesPrompt.js +106 -9
  8. package/lib/esm/commands/init/mappers/mapToContext.js +8 -3
  9. package/lib/esm/commands/init/prompts/getFeaturesPrompt.js +0 -12
  10. package/lib/esm/commands/init/utils/hasFeature.js +3 -0
  11. package/lib/esm/commands/run/RunCmd.js +22 -26
  12. package/lib/esm/commands/template/CreateTemplateCommand.js +101 -0
  13. package/lib/esm/commands/update/UpdateCmd.js +9 -13
  14. package/lib/esm/fn/exec.js +5 -0
  15. package/lib/esm/fn/render.js +5 -0
  16. package/lib/esm/fn/taskOutput.js +7 -0
  17. package/lib/esm/index.js +10 -5
  18. package/lib/esm/interfaces/AlterPackageJson.js +1 -0
  19. package/lib/esm/interfaces/AlterProjectFiles.js +1 -0
  20. package/lib/esm/interfaces/AlterRenderFiles.js +1 -0
  21. package/lib/esm/interfaces/CliCommandHooks.js +1 -0
  22. package/lib/esm/interfaces/GenerateCmdContext.js +1 -0
  23. package/lib/esm/interfaces/InitCmdOptions.js +1 -0
  24. package/lib/esm/interfaces/RenderDataContext.js +1 -0
  25. package/lib/esm/interfaces/RuntimeTypes.js +1 -0
  26. package/lib/esm/interfaces/index.js +9 -0
  27. package/lib/esm/pipes/OutputFilePathPipe.js +40 -18
  28. package/lib/esm/pipes/RoutePipe.js +4 -8
  29. package/lib/esm/pipes/{ClassNamePipe.js → SymbolNamePipe.js} +14 -11
  30. package/lib/esm/pipes/index.js +1 -1
  31. package/lib/esm/platforms/{InitPlatformsModule.js → PlatformsModule.js} +4 -10
  32. package/lib/esm/platforms/supports/InitExpressPlatform.js +27 -10
  33. package/lib/esm/platforms/supports/InitFastifyPlatform.js +27 -10
  34. package/lib/esm/platforms/supports/InitKoaPlatform.js +16 -10
  35. package/lib/esm/processors/__fixtures__/createFakeProject.js +35 -0
  36. package/lib/esm/processors/transformBinFile.js +47 -0
  37. package/lib/esm/processors/transformConfigFile.js +105 -0
  38. package/lib/esm/processors/transformIndexFile.js +23 -0
  39. package/lib/esm/processors/transformServerFile.js +60 -0
  40. package/lib/esm/runtimes/RuntimesModule.js +7 -17
  41. package/lib/esm/runtimes/supports/BabelRuntime.js +5 -11
  42. package/lib/esm/runtimes/supports/BunRuntime.js +4 -10
  43. package/lib/esm/runtimes/supports/NodeRuntime.js +1 -1
  44. package/lib/esm/runtimes/supports/WebpackRuntime.js +1 -1
  45. package/lib/esm/services/CliProjectService.js +95 -0
  46. package/lib/esm/services/CliRunScript.js +4 -8
  47. package/lib/esm/services/CliTemplatesService.js +119 -0
  48. package/lib/esm/services/ProjectClient.js +162 -0
  49. package/lib/esm/services/mappers/addContextMethods.js +17 -0
  50. package/lib/esm/services/mappers/mapDefaultTemplateOptions.js +36 -0
  51. package/lib/esm/templates/asyncFactory.template.js +38 -0
  52. package/lib/esm/templates/barrels.template.js +27 -0
  53. package/lib/esm/templates/command.template.js +56 -0
  54. package/lib/esm/templates/config.template.js +27 -0
  55. package/lib/esm/templates/controller.template.js +44 -0
  56. package/lib/esm/templates/decorator.template.js +184 -0
  57. package/lib/esm/templates/docker-compose.template.js +25 -0
  58. package/lib/esm/templates/dockerfile.template.js +236 -0
  59. package/lib/esm/templates/exception-filter.template.js +19 -0
  60. package/lib/esm/templates/factory.template.js +37 -0
  61. package/lib/esm/templates/index.command.template.js +22 -0
  62. package/lib/esm/templates/index.config.utils.template.js +17 -0
  63. package/{templates/init/src/controllers/pages/IndexController.ts.hbs → lib/esm/templates/index.controller.template.js} +14 -3
  64. package/lib/esm/templates/index.js +32 -0
  65. package/lib/esm/templates/index.logger.template.js +41 -0
  66. package/{templates/init/src/index.ts.hbs → lib/esm/templates/index.template.js} +17 -5
  67. package/lib/esm/templates/interceptor.template.js +31 -0
  68. package/lib/esm/templates/interface.template.js +13 -0
  69. package/lib/esm/templates/middleware.template.js +36 -0
  70. package/lib/esm/templates/model.template.js +16 -0
  71. package/lib/esm/templates/module.template.js +16 -0
  72. package/lib/esm/templates/new-template.template.js +67 -0
  73. package/lib/esm/templates/pipe.template.js +19 -0
  74. package/lib/esm/templates/pm2.template.js +111 -0
  75. package/lib/esm/templates/prisma.service.template.js +23 -0
  76. package/{templates/init/README.md.hbs → lib/esm/templates/readme.template.js} +28 -13
  77. package/lib/esm/templates/repository.template.js +16 -0
  78. package/lib/esm/templates/response-filter.template.js +19 -0
  79. package/lib/esm/templates/server.template.js +37 -0
  80. package/lib/esm/templates/service.template.js +16 -0
  81. package/lib/esm/templates/tsconfig.spec.template.js +35 -0
  82. package/lib/esm/templates/value.template.js +13 -0
  83. package/lib/esm/utils/defineTemplate.js +13 -0
  84. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  85. package/lib/types/bin/tsed.d.ts +1 -1
  86. package/lib/types/commands/add/AddCmd.d.ts +2 -2
  87. package/lib/types/commands/generate/GenerateCmd.d.ts +9 -98
  88. package/lib/types/commands/generate/mappers/mapGenerateContext.d.ts +2 -0
  89. package/lib/types/commands/index.d.ts +2 -1
  90. package/lib/types/commands/init/InitCmd.d.ts +18 -20
  91. package/lib/types/commands/init/config/FeaturesPrompt.d.ts +19 -3
  92. package/lib/types/commands/init/mappers/mapToContext.d.ts +2 -2
  93. package/lib/types/commands/init/mappers/mapUniqFeatures.d.ts +1 -1
  94. package/lib/types/commands/init/prompts/getFeaturesPrompt.d.ts +1 -7
  95. package/lib/types/commands/init/utils/hasFeature.d.ts +1 -0
  96. package/lib/types/commands/template/CreateTemplateCommand.d.ts +62 -0
  97. package/lib/types/commands/update/UpdateCmd.d.ts +2 -2
  98. package/lib/types/fn/exec.d.ts +1 -0
  99. package/lib/types/fn/render.d.ts +2 -0
  100. package/lib/types/fn/taskOutput.d.ts +1 -0
  101. package/lib/types/index.d.ts +10 -5
  102. package/lib/types/interfaces/AlterGenerateTasks.d.ts +5 -0
  103. package/lib/types/interfaces/AlterInitSubTasks.d.ts +5 -0
  104. package/lib/types/interfaces/AlterPackageJson.d.ts +5 -0
  105. package/lib/types/interfaces/AlterProjectFiles.d.ts +5 -0
  106. package/lib/types/interfaces/AlterRenderFiles.d.ts +10 -0
  107. package/lib/types/interfaces/CliCommandHooks.d.ts +11 -0
  108. package/lib/types/interfaces/GenerateCmdContext.d.ts +21 -0
  109. package/lib/types/interfaces/InitCmdOptions.d.ts +8 -0
  110. package/lib/types/interfaces/PlatformType.d.ts +7 -0
  111. package/lib/types/interfaces/RenderDataContext.d.ts +62 -0
  112. package/lib/types/interfaces/RuntimeTypes.d.ts +8 -0
  113. package/lib/types/interfaces/index.d.ts +9 -0
  114. package/lib/types/pipes/OutputFilePathPipe.d.ts +7 -4
  115. package/lib/types/pipes/{ClassNamePipe.d.ts → SymbolNamePipe.d.ts} +4 -4
  116. package/lib/types/pipes/index.d.ts +1 -1
  117. package/lib/types/platforms/{InitPlatformsModule.d.ts → PlatformsModule.d.ts} +1 -1
  118. package/lib/types/platforms/supports/InitBasePlatform.d.ts +3 -0
  119. package/lib/types/platforms/supports/InitExpressPlatform.d.ts +2 -0
  120. package/lib/types/platforms/supports/InitFastifyPlatform.d.ts +2 -0
  121. package/lib/types/platforms/supports/InitKoaPlatform.d.ts +2 -0
  122. package/lib/types/processors/__fixtures__/createFakeProject.d.ts +5 -0
  123. package/lib/types/processors/transformBinFile.d.ts +3 -0
  124. package/lib/types/processors/transformConfigFile.d.ts +3 -0
  125. package/lib/types/processors/transformIndexFile.d.ts +3 -0
  126. package/lib/types/processors/transformServerFile.d.ts +3 -0
  127. package/lib/types/runtimes/RuntimesModule.d.ts +5 -5
  128. package/lib/types/services/CliProjectService.d.ts +16 -0
  129. package/lib/types/services/CliTemplatesService.d.ts +35 -0
  130. package/lib/types/services/ProjectClient.d.ts +40 -0
  131. package/lib/types/services/mappers/addContextMethods.d.ts +12 -0
  132. package/lib/types/services/mappers/mapDefaultTemplateOptions.d.ts +11 -0
  133. package/lib/types/templates/asyncFactory.template.d.ts +16 -0
  134. package/lib/types/templates/barrels.template.d.ts +16 -0
  135. package/lib/types/templates/command.template.d.ts +16 -0
  136. package/lib/types/templates/config.template.d.ts +16 -0
  137. package/lib/types/templates/controller.template.d.ts +17 -0
  138. package/lib/types/templates/decorator.template.d.ts +17 -0
  139. package/lib/types/templates/docker-compose.template.d.ts +16 -0
  140. package/lib/types/templates/dockerfile.template.d.ts +1 -0
  141. package/lib/types/templates/exception-filter.template.d.ts +16 -0
  142. package/lib/types/templates/factory.template.d.ts +16 -0
  143. package/lib/types/templates/index.command.template.d.ts +16 -0
  144. package/lib/types/templates/index.config.utils.template.d.ts +16 -0
  145. package/lib/types/templates/index.controller.template.d.ts +16 -0
  146. package/lib/types/templates/index.d.ts +31 -0
  147. package/lib/types/templates/index.logger.template.d.ts +16 -0
  148. package/lib/types/templates/index.template.d.ts +16 -0
  149. package/lib/types/templates/interceptor.template.d.ts +16 -0
  150. package/lib/types/templates/interface.template.d.ts +16 -0
  151. package/lib/types/templates/middleware.template.d.ts +17 -0
  152. package/lib/types/templates/model.template.d.ts +16 -0
  153. package/lib/types/templates/module.template.d.ts +16 -0
  154. package/lib/types/templates/new-template.template.d.ts +9 -0
  155. package/lib/types/templates/pipe.template.d.ts +16 -0
  156. package/lib/types/templates/pm2.template.d.ts +1 -0
  157. package/lib/types/templates/prisma.service.template.d.ts +16 -0
  158. package/lib/types/templates/readme.template.d.ts +16 -0
  159. package/lib/types/templates/repository.template.d.ts +16 -0
  160. package/lib/types/templates/response-filter.template.d.ts +16 -0
  161. package/lib/types/templates/server.template.d.ts +16 -0
  162. package/lib/types/templates/service.template.d.ts +16 -0
  163. package/lib/types/templates/tsconfig.spec.template.d.ts +16 -0
  164. package/lib/types/templates/value.template.d.ts +16 -0
  165. package/lib/types/utils/defineTemplate.d.ts +67 -0
  166. package/package.json +14 -12
  167. package/templates/{init/tsconfig.json.hbs → tsconfig.json} +2 -7
  168. package/templates/tsconfig.node.json +14 -0
  169. package/templates/webpack.config.js +55 -0
  170. package/lib/esm/Cli.js +0 -57
  171. package/lib/esm/commands/generate/ProviderTypes.js +0 -103
  172. package/lib/esm/commands/init/interfaces/InitOptions.js +0 -5
  173. package/lib/esm/services/ProvidersInfoService.js +0 -46
  174. package/lib/esm/services/Renderer.js +0 -162
  175. package/lib/esm/utils/fillImports.js +0 -38
  176. package/lib/esm/utils/hbs/array.js +0 -515
  177. package/lib/esm/utils/hbs/collection.js +0 -60
  178. package/lib/esm/utils/hbs/comparison.js +0 -431
  179. package/lib/esm/utils/hbs/index.js +0 -11
  180. package/lib/esm/utils/hbs/object.js +0 -236
  181. package/lib/esm/utils/hbs/switch.js +0 -10
  182. package/lib/esm/utils/renderer/insertAfter.js +0 -12
  183. package/lib/esm/utils/renderer/insertImport.js +0 -11
  184. package/lib/types/Cli.d.ts +0 -26
  185. package/lib/types/commands/generate/ProviderTypes.d.ts +0 -11
  186. package/lib/types/commands/init/interfaces/InitCmdContext.d.ts +0 -6
  187. package/lib/types/commands/init/interfaces/InitOptions.d.ts +0 -20
  188. package/lib/types/services/ProvidersInfoService.d.ts +0 -21
  189. package/lib/types/services/Renderer.d.ts +0 -44
  190. package/lib/types/utils/fillImports.d.ts +0 -1
  191. package/lib/types/utils/hbs/array.d.ts +0 -1
  192. package/lib/types/utils/hbs/collection.d.ts +0 -1
  193. package/lib/types/utils/hbs/comparison.d.ts +0 -1
  194. package/lib/types/utils/hbs/object.d.ts +0 -1
  195. package/lib/types/utils/hbs/switch.d.ts +0 -1
  196. package/lib/types/utils/renderer/insertAfter.d.ts +0 -1
  197. package/lib/types/utils/renderer/insertImport.d.ts +0 -1
  198. package/templates/generate/async.factory.hbs +0 -35
  199. package/templates/generate/command.hbs +0 -45
  200. package/templates/generate/controller.hbs +0 -10
  201. package/templates/generate/decorator.class.hbs +0 -14
  202. package/templates/generate/decorator.endpoint.hbs +0 -15
  203. package/templates/generate/decorator.generic.hbs +0 -19
  204. package/templates/generate/decorator.method.hbs +0 -16
  205. package/templates/generate/decorator.middleware.hbs +0 -26
  206. package/templates/generate/decorator.param.hbs +0 -15
  207. package/templates/generate/decorator.parameters.hbs +0 -9
  208. package/templates/generate/decorator.prop.hbs +0 -14
  209. package/templates/generate/decorator.property.hbs +0 -5
  210. package/templates/generate/exception-filter.hbs +0 -9
  211. package/templates/generate/factory.hbs +0 -11
  212. package/templates/generate/injectable.hbs +0 -6
  213. package/templates/generate/interceptor.hbs +0 -21
  214. package/templates/generate/interface.hbs +0 -3
  215. package/templates/generate/middleware.hbs +0 -9
  216. package/templates/generate/model.hbs +0 -6
  217. package/templates/generate/module.hbs +0 -6
  218. package/templates/generate/pipe.hbs +0 -9
  219. package/templates/generate/prisma.service.hbs +0 -13
  220. package/templates/generate/repository.hbs +0 -6
  221. package/templates/generate/response-filter.hbs +0 -9
  222. package/templates/generate/server/_partials/server-footer.hbs +0 -10
  223. package/templates/generate/server/_partials/server-header.hbs +0 -34
  224. package/templates/generate/server/express/server.hbs +0 -10
  225. package/templates/generate/server/fastify/server.hbs +0 -14
  226. package/templates/generate/server/koa/server.hbs +0 -8
  227. package/templates/generate/service.hbs +0 -6
  228. package/templates/generate/value.hbs +0 -3
  229. package/templates/init/.barrels.json.hbs +0 -9
  230. package/templates/init/.gitignore.hbs +0 -57
  231. package/templates/init/.npmrc.hbs +0 -2
  232. package/templates/init/docker/_partials/docker-body.hbs +0 -5
  233. package/templates/init/docker/_partials/docker-dev-tools.hbs +0 -2
  234. package/templates/init/docker/_partials/docker-header.hbs +0 -16
  235. package/templates/init/docker/bun/Dockerfile.hbs +0 -36
  236. package/templates/init/docker/npm/Dockerfile.hbs +0 -28
  237. package/templates/init/docker/pnpm/Dockerfile.hbs +0 -28
  238. package/templates/init/docker/yarn/Dockerfile.hbs +0 -28
  239. package/templates/init/docker/yarn_berry/Dockerfile.hbs +0 -31
  240. package/templates/init/docker-compose.yml.hbs +0 -14
  241. package/templates/init/pm2/bun/processes.config.cjs.hbs +0 -23
  242. package/templates/init/pm2/node-compiled/processes.config.cjs.hbs +0 -22
  243. package/templates/init/pm2/node-loader/processes.config.cjs.hbs +0 -24
  244. package/templates/init/src/bin/index.ts.hbs +0 -9
  245. package/templates/init/src/config/envs/index.ts.hbs +0 -7
  246. package/templates/init/src/config/index.ts.hbs +0 -38
  247. package/templates/init/src/config/logger/index.ts.hbs +0 -25
  248. package/templates/init/tsconfig.node.json.hbs +0 -20
  249. package/templates/init/tsconfig.spec.json.hbs +0 -25
  250. package/templates/init/webpack.config.js.hbs +0 -65
  251. /package/lib/esm/{commands/init/interfaces/InitCmdContext.js → interfaces/AlterGenerateTasks.js} +0 -0
  252. /package/lib/{types/utils/hbs/index.d.ts → esm/interfaces/AlterInitSubTasks.js} +0 -0
  253. /package/templates/{init/.babelrc.hbs → .babelrc} +0 -0
  254. /package/templates/{init/.dockerignore.hbs → .dockerignore} +0 -0
  255. /package/templates/{init/.swcrc.hbs → .swcrc} +0 -0
  256. /package/templates/{init/.yarnrc.hbs → .yarnrc} +0 -0
  257. /package/templates/{init/nodemon.json.hbs → nodemon.json} +0 -0
  258. /package/templates/{init/tsconfig.base.json.hbs → tsconfig.base.json} +0 -0
  259. /package/templates/{init/views/swagger.ejs.hbs → views/swagger.ejs} +0 -0
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export {};
2
+ import "@swc-node/register/esm-register";
@@ -1,5 +1,5 @@
1
- import { type CliDefaultOptions, CliPlugins, type CommandProvider, PackageManagersModule, ProjectPackageJson, type QuestionOptions, type Task } from "@tsed/cli-core";
2
- export interface AddCmdOptions extends CliDefaultOptions {
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,12 @@
1
- import { type CliDefaultOptions, type CommandProvider, ProjectPackageJson } from "@tsed/cli-core";
2
- import type { PlatformType } from "../../interfaces/index.js";
3
- import { ProjectConvention } from "../../interfaces/ProjectConvention.js";
4
- import { ClassNamePipe } from "../../pipes/ClassNamePipe.js";
5
- import { OutputFilePathPipe } from "../../pipes/OutputFilePathPipe.js";
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";
22
5
  export declare class GenerateCmd implements CommandProvider {
23
- private providersList;
24
- classNamePipe: ClassNamePipe;
25
- outputFilePathPipe: OutputFilePathPipe;
26
- routePipe: RoutePipe;
27
- srcRenderService: SrcRendererService;
28
- projectPackageJson: ProjectPackageJson;
29
- constructor(providersList: ProvidersInfoService);
30
- $prompt(initialOptions: Partial<GenerateCmdContext>): ({
31
- type: string;
32
- name: string;
33
- message: string;
34
- default: string | undefined;
35
- when: () => boolean;
36
- source: (state: any, keyword: string) => any;
37
- choices?: undefined;
38
- } | {
39
- type: string;
40
- name: string;
41
- message: string;
42
- default: (state: any) => string;
43
- when: boolean;
44
- source?: undefined;
45
- choices?: undefined;
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
- })[];
6
+ protected projectPackageJson: ProjectPackageJson;
7
+ protected projectService: CliProjectService;
8
+ protected templates: CliTemplatesService;
9
+ $prompt(data: Partial<GenerateCmdContext>): Promise<any[]>;
90
10
  $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[];
11
+ $exec(ctx: GenerateCmdContext): Task[];
101
12
  }
@@ -0,0 +1,2 @@
1
+ import type { GenerateCmdContext } from "../../../interfaces/GenerateCmdContext.js";
2
+ export declare function mapGenerateContext(ctx: Partial<GenerateCmdContext>): GenerateCmdContext;
@@ -2,6 +2,7 @@ import { AddCmd } from "./add/AddCmd.js";
2
2
  import { GenerateCmd } from "./generate/GenerateCmd.js";
3
3
  import { InitCmd } from "./init/InitCmd.js";
4
4
  import { RunCmd } from "./run/RunCmd.js";
5
+ import { CreateTemplateCommand } from "./template/CreateTemplateCommand.js";
5
6
  import { UpdateCmd } from "./update/UpdateCmd.js";
6
- declare const _default: (typeof AddCmd | typeof GenerateCmd | typeof InitCmd | typeof RunCmd | typeof UpdateCmd)[];
7
+ declare const _default: (typeof CreateTemplateCommand | typeof AddCmd | typeof GenerateCmd | typeof InitCmd | typeof RunCmd | typeof UpdateCmd)[];
7
8
  export default _default;
@@ -1,38 +1,36 @@
1
- import { CliExeca, CliFs, CliLoadFile, CliPlugins, CliService, type CommandProvider, PackageManagersModule, ProjectPackageJson, type QuestionOptions, type Task } from "@tsed/cli-core";
2
- import { OutputFilePathPipe } from "../../pipes/OutputFilePathPipe.js";
3
- import { InitPlatformsModule } from "../../platforms/InitPlatformsModule.js";
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 { RootRendererService } from "../../services/Renderer.js";
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: InitPlatformsModule;
13
+ protected platforms: PlatformsModule;
15
14
  protected cliPackageJson: import("@tsed/cli-core").PackageJson;
16
- protected cliService: CliService;
17
15
  protected cliLoadFile: CliLoadFile;
18
- protected rootRenderer: RootRendererService;
19
- protected outputFilePathPipe: OutputFilePathPipe;
16
+ protected project: CliProjectService;
20
17
  protected execa: CliExeca;
21
18
  protected fs: CliFs;
22
- checkPrecondition(ctx: InitCmdContext): void;
19
+ checkPrecondition(ctx: InitOptions): void;
23
20
  $beforePrompt(initialOptions: Partial<InitOptions>): Promise<any>;
24
21
  $prompt(initialOptions: Partial<InitOptions>): QuestionOptions;
25
- $mapContext(ctx: any): InitCmdContext;
26
- $beforeExec(ctx: InitCmdContext): Promise<any>;
27
- $exec(ctx: InitCmdContext): Promise<Task[]>;
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<InitCmdContext>): void;
33
- addScripts(ctx: InitCmdContext): void;
34
- addDependencies(ctx: InitCmdContext): void;
35
- addDevDependencies(ctx: InitCmdContext): void;
36
- addFeatures(ctx: InitCmdContext): void;
37
- private generateFiles;
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:premium",
24
+ CONFIG_IOREDIS = "config:ioredis:premium",
25
+ CONFIG_MONGO = "config:mongo:premium",
26
+ CONFIG_VAULT = "config:vault:premium",
27
+ CONFIG_POSTGRES = "config:postgres:premium",
19
28
  SWAGGER = "swagger",
20
29
  SCALAR = "scalar",
21
30
  PRISMA = "prisma",
@@ -51,6 +60,13 @@ export declare const FrameworksPrompt: {
51
60
  choices: PlatformType[];
52
61
  };
53
62
  export declare const FeaturesPrompt: (availableRuntimes: string[], availablePackageManagers: string[]) => ({
63
+ type: string;
64
+ name: string;
65
+ message: string;
66
+ when: (ctx: any) => boolean;
67
+ default?: undefined;
68
+ choices?: undefined;
69
+ } | {
54
70
  message: string;
55
71
  name: string;
56
72
  default: string;
@@ -62,8 +78,8 @@ export declare const FeaturesPrompt: (availableRuntimes: string[], availablePack
62
78
  type: string;
63
79
  name: string;
64
80
  choices: string[];
65
- default?: undefined;
66
81
  when?: undefined;
82
+ default?: undefined;
67
83
  } | {
68
84
  message: string;
69
85
  type: string;
@@ -1,2 +1,2 @@
1
- import type { InitCmdContext } from "../interfaces/InitCmdContext.js";
2
- export declare function mapToContext(options: any): InitCmdContext;
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 "../interfaces/InitOptions.js";
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,8 +1,2 @@
1
- import type { InitOptions } from "../interfaces/InitOptions.js";
1
+ import type { InitOptions } from "../../../interfaces/index.js";
2
2
  export declare function getFeaturesPrompt(runtimes: string[], availablePackageManagers: string[], options: Partial<InitOptions>): any[];
3
- export declare function getFrameworksPrompt(): {
4
- choices: any[];
5
- message: string;
6
- type: string;
7
- name: string;
8
- };
@@ -1,2 +1,3 @@
1
1
  export declare function hasValue(expression: string, value: string | string[]): (ctx: any) => boolean;
2
2
  export declare function hasFeature(feature: string): (ctx: any) => boolean;
3
+ export declare function hasValuePremium(): (ctx: any) => boolean;
@@ -0,0 +1,62 @@
1
+ import { type CommandProvider, ProjectPackageJson } from "@tsed/cli-core";
2
+ import type { RenderDataContext } from "../../interfaces/RenderDataContext.js";
3
+ import { CliTemplatesService } from "../../services/CliTemplatesService.js";
4
+ import type { DefineTemplateOptions } from "../../utils/defineTemplate.js";
5
+ export interface CreateTemplateCmdContext extends RenderDataContext {
6
+ name: string;
7
+ from?: string | "new";
8
+ override?: string;
9
+ templateId?: string;
10
+ template?: DefineTemplateOptions;
11
+ }
12
+ export declare class CreateTemplateCommand implements CommandProvider {
13
+ protected projectPackageJson: ProjectPackageJson;
14
+ protected templates: CliTemplatesService;
15
+ $prompt(data: Partial<CreateTemplateCmdContext>): Promise<({
16
+ type: string;
17
+ name: string;
18
+ message: string;
19
+ default: string;
20
+ when: boolean;
21
+ choices: {
22
+ name: string;
23
+ value: string;
24
+ }[];
25
+ source?: undefined;
26
+ } | {
27
+ type: string;
28
+ name: string;
29
+ message: string;
30
+ default: string | undefined;
31
+ when: (ctx: CreateTemplateCmdContext) => boolean;
32
+ source: (_: any, keyword: string) => {
33
+ name: string;
34
+ value: string;
35
+ }[];
36
+ choices?: undefined;
37
+ } | {
38
+ type: string;
39
+ name: string;
40
+ message: string;
41
+ when: (ctx: CreateTemplateCmdContext) => boolean;
42
+ default: boolean;
43
+ choices?: undefined;
44
+ source?: undefined;
45
+ } | {
46
+ type: string;
47
+ name: string;
48
+ message: string;
49
+ default: string | undefined;
50
+ when: boolean;
51
+ choices?: undefined;
52
+ source?: undefined;
53
+ })[]>;
54
+ $mapContext(ctx: Partial<any>): any;
55
+ $exec(ctx: CreateTemplateCmdContext & {
56
+ symbolName: string;
57
+ symbolPath: string;
58
+ }): {
59
+ title: string;
60
+ task: () => Promise<void>;
61
+ }[];
62
+ }
@@ -1,5 +1,5 @@
1
- import { type CliDefaultOptions, type CommandProvider, NpmRegistryClient, PackageManagersModule, ProjectPackageJson, type QuestionOptions, type Task } from "@tsed/cli-core";
2
- export interface UpdateCmdContext extends CliDefaultOptions {
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,2 @@
1
+ import { CliProjectService } from "../services/CliProjectService.js";
2
+ export declare function render(id: string, data: Parameters<typeof CliProjectService.prototype.createFromTemplate>[1]): Promise<import("../index.js").TemplateRenderReturnType | undefined>;
@@ -0,0 +1 @@
1
+ export declare function taskOutput(output: string): void;
@@ -1,16 +1,21 @@
1
- export * from "./Cli.js";
1
+ import "@tsed/logger-std";
2
+ import "./templates/index.js";
2
3
  export * from "./commands/add/AddCmd.js";
3
4
  export * from "./commands/generate/GenerateCmd.js";
5
+ export { default as commands } from "./commands/index.js";
4
6
  export * from "./commands/init/config/FeaturesPrompt.js";
5
7
  export * from "./commands/init/config/FeaturesPrompt.js";
6
8
  export * from "./commands/init/InitCmd.js";
7
- export * from "./commands/init/interfaces/InitCmdContext.js";
8
- export * from "./commands/init/interfaces/InitOptions.js";
9
9
  export * from "./commands/init/prompts/getFeaturesPrompt.js";
10
10
  export * from "./commands/update/UpdateCmd.js";
11
11
  export * from "./constants/index.js";
12
+ export * from "./fn/exec.js";
13
+ export * from "./fn/render.js";
12
14
  export * from "./interfaces/index.js";
13
15
  export * from "./pipes/index.js";
14
16
  export * from "./runtimes/index.js";
15
- export * from "./services/ProvidersInfoService.js";
16
- export * from "./services/Renderer.js";
17
+ export * from "./services/CliProjectService.js";
18
+ export * from "./services/CliTemplatesService.js";
19
+ export * from "./services/ProjectClient.js";
20
+ export * from "./utils/defineTemplate.js";
21
+ export { CliCore } from "@tsed/cli-core";
@@ -0,0 +1,5 @@
1
+ import type { Task } from "@tsed/cli-core";
2
+ import type { GenerateCmdContext } from "./GenerateCmdContext.js";
3
+ export interface AlterGenerateTasks {
4
+ $alterGenerateTasks(tasks: Task[], data: GenerateCmdContext): Task[] | Promise<Task[]>;
5
+ }
@@ -0,0 +1,5 @@
1
+ import type { Task } from "@tsed/cli-core";
2
+ import type { InitCmdContext } from "./InitCmdOptions.js";
3
+ export interface AlterInitSubTasks {
4
+ $alterInitSubTasks(tasks: Task[], data: InitCmdContext): Task[] | Promise<Task[]>;
5
+ }
@@ -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,21 @@
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
+ getRoute: (state: Partial<GenerateCmdContext> | string) => string;
20
+ getDirectories: (dir: string) => string[];
21
+ }
@@ -0,0 +1,8 @@
1
+ import type { RenderDataContext } from "./RenderDataContext.js";
2
+ export interface InitOptions extends RenderDataContext {
3
+ root: string;
4
+ srcDir: string;
5
+ skipPrompt: boolean;
6
+ GH_TOKEN?: string;
7
+ }
8
+ export type InitCmdContext = InitOptions;
@@ -3,3 +3,10 @@ export declare enum PlatformType {
3
3
  KOA = "koa",
4
4
  FASTIFY = "fastify"
5
5
  }
6
+ declare global {
7
+ namespace TsED {
8
+ interface ProjectPreferences {
9
+ platform: PlatformType;
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,62 @@
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
+ premium?: boolean;
23
+ projectName?: string;
24
+ tsedVersion?: string;
25
+ cliVersion?: string;
26
+ oidcBasePath?: string;
27
+ file?: string;
28
+ route: string;
29
+ express?: boolean;
30
+ koa?: boolean;
31
+ fastify?: boolean;
32
+ swagger?: boolean;
33
+ oidc?: boolean;
34
+ graphql?: boolean;
35
+ scalar?: boolean;
36
+ mongoose?: boolean;
37
+ typeorm?: boolean;
38
+ passportjs?: boolean;
39
+ config?: boolean;
40
+ configEnvs?: boolean;
41
+ configDotenv?: boolean;
42
+ configJson?: boolean;
43
+ configYaml?: boolean;
44
+ configIoredis?: boolean;
45
+ configMongo?: boolean;
46
+ configAwsSecrets?: boolean;
47
+ configVault?: boolean;
48
+ configPostgres?: boolean;
49
+ barrels?: string;
50
+ bun?: boolean;
51
+ node?: boolean;
52
+ compiled?: boolean;
53
+ testing?: boolean;
54
+ commands?: boolean;
55
+ eslint?: boolean;
56
+ jest?: boolean;
57
+ prettier?: boolean;
58
+ vitest?: boolean;
59
+ lintstaged?: boolean;
60
+ prisma?: boolean;
61
+ passport?: boolean;
62
+ }
@@ -0,0 +1,8 @@
1
+ export type RuntimeTypes = "node" | "babel" | "swc" | "webpack" | "bun";
2
+ declare global {
3
+ namespace TsED {
4
+ interface ProjectPreferences {
5
+ runtime: RuntimeTypes;
6
+ }
7
+ }
8
+ }
@@ -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 { ProvidersInfoService } from "../services/ProvidersInfoService.js";
4
- import { ClassNamePipe } from "./ClassNamePipe.js";
3
+ import { CliTemplatesService } from "../services/CliTemplatesService.js";
4
+ import { SymbolNamePipe } from "./SymbolNamePipe.js";
5
5
  export declare class OutputFilePathPipe {
6
- protected providers: ProvidersInfoService;
6
+ protected templatesService: CliTemplatesService;
7
7
  protected projectPackageJson: ProjectPackageJson;
8
- protected classNamePipe: 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,12 +1,12 @@
1
1
  import { ProjectPackageJson } from "@tsed/cli-core";
2
2
  import { ProjectConvention } from "../interfaces/ProjectConvention.js";
3
- import { ProvidersInfoService } from "../services/ProvidersInfoService.js";
4
- export declare class ClassNamePipe {
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;
10
10
  format?: ProjectConvention;
11
- }): string;
11
+ }): any;
12
12
  }
@@ -1,3 +1,3 @@
1
- export * from "./ClassNamePipe.js";
2
1
  export * from "./OutputFilePathPipe.js";
3
2
  export * from "./RoutePipe.js";
3
+ export * from "./SymbolNamePipe.js";
@@ -1,5 +1,5 @@
1
1
  import type { InitBasePlatform } from "./supports/InitBasePlatform.js";
2
- export declare class InitPlatformsModule {
2
+ export declare class PlatformsModule {
3
3
  private platforms;
4
4
  get(name: string): InitBasePlatform;
5
5
  }
@@ -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;