@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
@@ -0,0 +1,16 @@
1
+ declare const _default: import("@tsed/di").FactoryTokenProvider<{
2
+ id: string;
3
+ label: string;
4
+ description?: string;
5
+ outputDir: string;
6
+ type?: string;
7
+ fileName?: string;
8
+ ext: string | null;
9
+ hidden?: boolean;
10
+ preserveCase?: boolean;
11
+ preserveDirectory?: boolean;
12
+ render(symbolName: string, data: import("../index.js").GenerateCmdContext): Promise<string | undefined | import("../index.js").TemplateRenderReturnType> | string | undefined | import("../index.js").TemplateRenderReturnType;
13
+ prompts?(data: import("../index.js").GenerateCmdContext): import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[] | Promise<import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[]>;
14
+ hooks?: import("@tsed/di").ProviderOpts["hooks"];
15
+ }>;
16
+ export default _default;
@@ -0,0 +1,16 @@
1
+ declare const _default: import("@tsed/di").FactoryTokenProvider<{
2
+ id: string;
3
+ label: string;
4
+ description?: string;
5
+ outputDir: string;
6
+ type?: string;
7
+ fileName?: string;
8
+ ext: string | null;
9
+ hidden?: boolean;
10
+ preserveCase?: boolean;
11
+ preserveDirectory?: boolean;
12
+ render(symbolName: string, data: import("../index.js").GenerateCmdContext): Promise<string | undefined | import("../index.js").TemplateRenderReturnType> | string | undefined | import("../index.js").TemplateRenderReturnType;
13
+ prompts?(data: import("../index.js").GenerateCmdContext): import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[] | Promise<import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[]>;
14
+ hooks?: import("@tsed/di").ProviderOpts["hooks"];
15
+ }>;
16
+ export default _default;
@@ -0,0 +1,16 @@
1
+ declare const _default: import("@tsed/di").FactoryTokenProvider<{
2
+ id: string;
3
+ label: string;
4
+ description?: string;
5
+ outputDir: string;
6
+ type?: string;
7
+ fileName?: string;
8
+ ext: string | null;
9
+ hidden?: boolean;
10
+ preserveCase?: boolean;
11
+ preserveDirectory?: boolean;
12
+ render(symbolName: string, data: import("../index.js").GenerateCmdContext): Promise<string | undefined | import("../index.js").TemplateRenderReturnType> | string | undefined | import("../index.js").TemplateRenderReturnType;
13
+ prompts?(data: import("../index.js").GenerateCmdContext): import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[] | Promise<import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[]>;
14
+ hooks?: import("@tsed/di").ProviderOpts["hooks"];
15
+ }>;
16
+ export default _default;
@@ -0,0 +1,16 @@
1
+ declare const _default: import("@tsed/di").FactoryTokenProvider<{
2
+ id: string;
3
+ label: string;
4
+ description?: string;
5
+ outputDir: string;
6
+ type?: string;
7
+ fileName?: string;
8
+ ext: string | null;
9
+ hidden?: boolean;
10
+ preserveCase?: boolean;
11
+ preserveDirectory?: boolean;
12
+ render(symbolName: string, data: import("../index.js").GenerateCmdContext): Promise<string | undefined | import("../index.js").TemplateRenderReturnType> | string | undefined | import("../index.js").TemplateRenderReturnType;
13
+ prompts?(data: import("../index.js").GenerateCmdContext): import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[] | Promise<import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[]>;
14
+ hooks?: import("@tsed/di").ProviderOpts["hooks"];
15
+ }>;
16
+ export default _default;
@@ -0,0 +1,16 @@
1
+ declare const _default: import("@tsed/di").FactoryTokenProvider<{
2
+ id: string;
3
+ label: string;
4
+ description?: string;
5
+ outputDir: string;
6
+ type?: string;
7
+ fileName?: string;
8
+ ext: string | null;
9
+ hidden?: boolean;
10
+ preserveCase?: boolean;
11
+ preserveDirectory?: boolean;
12
+ render(symbolName: string, data: import("../index.js").GenerateCmdContext): Promise<string | undefined | import("../index.js").TemplateRenderReturnType> | string | undefined | import("../index.js").TemplateRenderReturnType;
13
+ prompts?(data: import("../index.js").GenerateCmdContext): import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[] | Promise<import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[]>;
14
+ hooks?: import("@tsed/di").ProviderOpts["hooks"];
15
+ }>;
16
+ export default _default;
@@ -0,0 +1,16 @@
1
+ declare const _default: import("@tsed/di").FactoryTokenProvider<{
2
+ id: string;
3
+ label: string;
4
+ description?: string;
5
+ outputDir: string;
6
+ type?: string;
7
+ fileName?: string;
8
+ ext: string | null;
9
+ hidden?: boolean;
10
+ preserveCase?: boolean;
11
+ preserveDirectory?: boolean;
12
+ render(symbolName: string, data: import("../index.js").GenerateCmdContext): Promise<string | undefined | import("../index.js").TemplateRenderReturnType> | string | undefined | import("../index.js").TemplateRenderReturnType;
13
+ prompts?(data: import("../index.js").GenerateCmdContext): import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[] | Promise<import("@tsed/cli-core").QuestionOptions<import("../index.js").GenerateCmdContext>[]>;
14
+ hooks?: import("@tsed/di").ProviderOpts["hooks"];
15
+ }>;
16
+ export default _default;
@@ -0,0 +1,67 @@
1
+ import { type ProviderOpts, type QuestionOptions } from "@tsed/cli-core";
2
+ import type { GenerateCmdContext } from "../interfaces/index.js";
3
+ import type { TemplateRenderReturnType } from "../services/CliTemplatesService.js";
4
+ export type DefineTemplateOptions = {
5
+ id: string;
6
+ label: string;
7
+ description?: string;
8
+ outputDir: string;
9
+ type?: string;
10
+ /**
11
+ * The file name format without the extension.
12
+ */
13
+ fileName?: string;
14
+ /**
15
+ * The file extension. Default to `ts`
16
+ * Don't include the dot (.) in the extension.
17
+ */
18
+ ext?: string | null;
19
+ /**
20
+ * If `true` the template will be hidden in the list of available templates
21
+ * during the generate command.
22
+ */
23
+ hidden?: boolean;
24
+ /**
25
+ * If `true` the file name won't be altered (e.g. `MyService` will always be `MyService.ts`)
26
+ * If `false` the file name will be transformed depending on the project style (e.g. `MyService` could be `my-service.ts`).
27
+ * @default false
28
+ */
29
+ preserveCase?: boolean;
30
+ /**
31
+ * If `true` the directory structure will be preserved when generating the file.
32
+ */
33
+ preserveDirectory?: boolean;
34
+ render(symbolName: string, data: GenerateCmdContext): Promise<string | undefined | TemplateRenderReturnType> | string | undefined | TemplateRenderReturnType;
35
+ prompts?(data: GenerateCmdContext): QuestionOptions<GenerateCmdContext>[] | Promise<QuestionOptions<GenerateCmdContext>[]>;
36
+ hooks?: ProviderOpts["hooks"];
37
+ };
38
+ export declare function defineTemplate(opts: DefineTemplateOptions): import("@tsed/cli-core").FactoryTokenProvider<{
39
+ id: string;
40
+ label: string;
41
+ description?: string;
42
+ outputDir: string;
43
+ type?: string;
44
+ /**
45
+ * The file name format without the extension.
46
+ */
47
+ fileName?: string;
48
+ ext: string | null;
49
+ /**
50
+ * If `true` the template will be hidden in the list of available templates
51
+ * during the generate command.
52
+ */
53
+ hidden?: boolean;
54
+ /**
55
+ * If `true` the file name won't be altered (e.g. `MyService` will always be `MyService.ts`)
56
+ * If `false` the file name will be transformed depending on the project style (e.g. `MyService` could be `my-service.ts`).
57
+ * @default false
58
+ */
59
+ preserveCase?: boolean;
60
+ /**
61
+ * If `true` the directory structure will be preserved when generating the file.
62
+ */
63
+ preserveDirectory?: boolean;
64
+ render(symbolName: string, data: GenerateCmdContext): Promise<string | undefined | TemplateRenderReturnType> | string | undefined | TemplateRenderReturnType;
65
+ prompts?(data: GenerateCmdContext): QuestionOptions<GenerateCmdContext>[] | Promise<QuestionOptions<GenerateCmdContext>[]>;
66
+ hooks?: ProviderOpts["hooks"];
67
+ }>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tsed/cli",
3
3
  "description": "CLI to bootstrap your Ts.ED project",
4
- "version": "6.6.3",
4
+ "version": "7.0.0-alpha.10",
5
5
  "type": "module",
6
6
  "main": "./lib/esm/index.js",
7
7
  "source": "./src/index.ts",
@@ -48,30 +48,29 @@
48
48
  "@swc-node/register": "^1.10.9",
49
49
  "@swc/core": "1.7.26",
50
50
  "@swc/helpers": "^0.5.13",
51
- "@tsed/cli-core": "6.6.3",
52
- "@tsed/core": ">=8.0.0",
53
- "@tsed/di": ">=8.0.0",
54
- "@tsed/hooks": ">=8.0.0",
51
+ "@tsed/cli-core": "7.0.0-alpha.10",
52
+ "@tsed/core": ">=8.17.3",
53
+ "@tsed/di": ">=8.17.3",
54
+ "@tsed/hooks": ">=8.17.3",
55
55
  "@tsed/logger": ">=8.0.3",
56
56
  "@tsed/logger-std": ">=8.0.3",
57
- "@tsed/normalize-path": ">=8.0.0",
58
- "@tsed/openspec": ">=8.0.0",
59
- "@tsed/schema": ">=8.0.0",
57
+ "@tsed/normalize-path": ">=8.17.3",
58
+ "@tsed/openspec": ">=8.17.3",
59
+ "@tsed/schema": ">=8.17.3",
60
60
  "chalk": "^5.3.0",
61
61
  "change-case": "^5.4.4",
62
62
  "consolidate": "^1.0.4",
63
63
  "create-frame": "^1.0.0",
64
64
  "fs-extra": "^11.2.0",
65
65
  "globby": "^14.0.2",
66
- "handlebars": "^4.7.8",
67
- "handlebars-utils": "^1.0.6",
68
66
  "read-pkg-up": "^11.0.0",
69
67
  "rxjs": "^7.8.1",
70
68
  "semver": "^7.6.3",
69
+ "ts-morph": "27.0.0",
71
70
  "tslib": "^2.7.0"
72
71
  },
73
72
  "devDependencies": {
74
- "@tsed/typescript": "6.6.3",
73
+ "@tsed/typescript": "7.0.0-alpha.10",
75
74
  "@types/change-case": "^2.3.1",
76
75
  "@types/consolidate": "0.14.4",
77
76
  "cross-env": "7.0.3",
@@ -116,5 +115,8 @@
116
115
  },
117
116
  "homepage": "https://github.com/tsedio/tsed-cli/tree/master/packages/cli",
118
117
  "author": "Romain Lenzotti",
119
- "license": "MIT"
118
+ "license": "MIT",
119
+ "publishConfig": {
120
+ "tag": "alpha"
121
+ }
120
122
  }
@@ -1,16 +1,11 @@
1
1
  {
2
2
  "extends": "./tsconfig.base.json",
3
- "compilerOptions": {
4
- "baseUrl": ".",
5
- "noEmit": true
6
- },
7
- "include": [],
8
3
  "references": [
9
4
  {
10
5
  "path": "./tsconfig.node.json"
11
- }{{#if testing}},
6
+ },
12
7
  {
13
8
  "path": "./tsconfig.spec.json"
14
- }{{/if}}
9
+ }
15
10
  ]
16
11
  }
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "./tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "baseUrl": ".",
5
+ "paths": {
6
+ "@/*": ["src/*"]
7
+ }
8
+ },
9
+ "include": ["src/**/*", ".templates/**/*"],
10
+ "exclude": ["src/**/*.spec.ts", "dist", "node_modules", "**/helpers/*Fixture.ts", "**/__mock__/**", "coverage"],
11
+ "linterOptions": {
12
+ "exclude": []
13
+ }
14
+ }
@@ -0,0 +1,55 @@
1
+ const webpack = require("webpack");
2
+ const path = require("path");
3
+
4
+ const {NODE_ENV = "development"} = process.env;
5
+ const isProduction = NODE_ENV !== "development";
6
+ const packages = require("./package.json");
7
+
8
+ module.exports = {
9
+ target: "node",
10
+ devtool: false,
11
+
12
+ externals: [...Object.keys(packages.dependencies || {})],
13
+
14
+ plugins: [
15
+ new webpack.EnvironmentPlugin({
16
+ NODE_ENV,
17
+ WEBPACK_ENV: true
18
+ }),
19
+ !isProduction && new webpack.HotModuleReplacementPlugin()
20
+ ].filter(Boolean),
21
+
22
+ entry: [!isProduction && "webpack/hot/poll?1000", path.resolve(path.join(__dirname, "./src/index"))].filter(Boolean),
23
+
24
+ output: {
25
+ path: path.resolve(__dirname, "dist"),
26
+ filename: "app.bundle.js",
27
+ libraryTarget: "commonjs2"
28
+ },
29
+
30
+ resolve: {
31
+ extensions: [".webpack-loader.js", ".web-loader.js", ".loader.js", ".js", ".jsx", ".ts", ".tsx", ".json"],
32
+ modules: [path.join(__dirname, "..", "src"), "node_modules"]
33
+ },
34
+
35
+ module: {
36
+ rules: [
37
+ {
38
+ // Include ts, tsx, js, and jsx files.
39
+ test: /\.(ts|js)x?$/,
40
+ exclude: /node_modules/,
41
+ loader: "babel-loader",
42
+ options: {
43
+ babelrc: true,
44
+ cacheDirectory: true
45
+ }
46
+ }
47
+ ]
48
+ },
49
+
50
+ node: {
51
+ global: false,
52
+ __filename: false,
53
+ __dirname: false
54
+ }
55
+ };
package/lib/esm/Cli.js DELETED
@@ -1,57 +0,0 @@
1
- import "@tsed/logger-std";
2
- import { CliCore } from "@tsed/cli-core";
3
- import chalk from "chalk";
4
- import commands from "./commands/index.js";
5
- import { PKG, TEMPLATE_DIR } from "./constants/index.js";
6
- import { ArchitectureConvention, ProjectConvention } from "./interfaces/index.js";
7
- export class Cli extends CliCore {
8
- static { this.defaults = {
9
- name: "tsed",
10
- pkg: PKG,
11
- templateDir: TEMPLATE_DIR,
12
- plugins: true,
13
- commands,
14
- defaultProjectPreferences() {
15
- return {
16
- convention: ProjectConvention.DEFAULT,
17
- architecture: ArchitectureConvention.DEFAULT
18
- };
19
- },
20
- project: {
21
- reinstallAfterRun: true
22
- },
23
- logger: {
24
- level: "info"
25
- }
26
- }; }
27
- static checkPackage(pkg) {
28
- if (!pkg) {
29
- console.log(chalk.red(`settings.pkg is required. Require the package.json of your CLI when you bootstrap the CLI.`));
30
- process.exit(1);
31
- }
32
- }
33
- static checkName(name) {
34
- if (!name) {
35
- console.log(chalk.red(`settings.name is required. Add the name of your CLI.`));
36
- process.exit(1);
37
- }
38
- }
39
- static checkPrecondition(settings) {
40
- const { pkg } = settings;
41
- this.checkPackage(pkg);
42
- this.checkName(pkg.name);
43
- if (pkg?.engines?.node) {
44
- this.checkNodeVersion(pkg.engines.node, pkg.name);
45
- }
46
- }
47
- static async bootstrap(settings = {}) {
48
- const opts = {
49
- ...Cli.defaults,
50
- ...settings
51
- };
52
- const { pkg } = opts;
53
- this.checkPrecondition(opts);
54
- await this.updateNotifier(pkg);
55
- return super.bootstrap(opts, Cli);
56
- }
57
- }
@@ -1,103 +0,0 @@
1
- export const PROVIDER_TYPES = [
2
- {
3
- name: "Controller",
4
- value: "controller",
5
- model: "{{symbolName}}.controller"
6
- },
7
- {
8
- name: "Middleware",
9
- value: "middleware",
10
- model: "{{symbolName}}.middleware"
11
- },
12
- {
13
- name: "Service",
14
- value: "service",
15
- baseDir: "services",
16
- model: "{{symbolName}}.service"
17
- },
18
- {
19
- name: "Model",
20
- value: "model",
21
- model: "{{symbolName}}.model"
22
- },
23
- {
24
- name: "Interface",
25
- value: "interface",
26
- model: "{{symbolName}}.interface?"
27
- },
28
- {
29
- name: "Decorator",
30
- value: "decorator",
31
- model: "{{symbolName}}.decorator?"
32
- },
33
- {
34
- name: "Module",
35
- value: "module",
36
- model: "{{symbolName}}.module"
37
- },
38
- {
39
- name: "Pipe",
40
- value: "pipe",
41
- baseDir: "pipes",
42
- model: "{{symbolName}}.pipe"
43
- },
44
- {
45
- name: "Interceptor",
46
- value: "interceptor",
47
- baseDir: "interceptors",
48
- model: "{{symbolName}}.interceptor"
49
- },
50
- {
51
- name: "Async Factory",
52
- value: "async.factory",
53
- baseDir: "services",
54
- model: "{{symbolName}}.factory?"
55
- },
56
- {
57
- name: "Factory",
58
- value: "factory",
59
- baseDir: "services",
60
- model: "{{symbolName}}.factory?"
61
- },
62
- {
63
- name: "Value",
64
- value: "value",
65
- baseDir: "services",
66
- model: "{{symbolName}}.value?"
67
- },
68
- {
69
- name: "Server",
70
- value: "server",
71
- model: "{{symbolName}}.server"
72
- },
73
- {
74
- name: "Exception Filter",
75
- value: "exception-filter",
76
- baseDir: "filters",
77
- model: "{{symbolName}}.exception-filter"
78
- },
79
- {
80
- name: "Response Filter",
81
- value: "response-filter",
82
- baseDir: "filters",
83
- model: "{{symbolName}}.response-filter"
84
- },
85
- {
86
- name: "Command",
87
- value: "command",
88
- baseDir: "bin",
89
- model: "{{symbolName}}.command"
90
- },
91
- {
92
- name: "Prisma Service",
93
- value: "prisma.service",
94
- baseDir: "services",
95
- model: "{{symbolName}}.service"
96
- },
97
- {
98
- name: "Repository",
99
- value: "repository",
100
- baseDir: "services",
101
- model: "{{symbolName}}.repository"
102
- }
103
- ];
@@ -1,5 +0,0 @@
1
- import { PackageManager } from "@tsed/cli-core";
2
- import { ArchitectureConvention } from "../../../interfaces/ArchitectureConvention.js";
3
- import { PlatformType } from "../../../interfaces/PlatformType.js";
4
- import { ProjectConvention } from "../../../interfaces/ProjectConvention.js";
5
- import { FeatureType } from "../config/FeaturesPrompt.js";
@@ -1,46 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { Injectable, nameOf, Type } from "@tsed/cli-core";
3
- let ProvidersInfoService = class ProvidersInfoService {
4
- constructor() {
5
- this.map = new Map();
6
- }
7
- /**
8
- *
9
- * @param providerInfo
10
- * @param owner
11
- */
12
- add(providerInfo, owner) {
13
- this.map.set(providerInfo.value, {
14
- ...providerInfo,
15
- owner: nameOf(owner)
16
- });
17
- return this;
18
- }
19
- get(value) {
20
- return this.map.get(value);
21
- }
22
- isMyProvider(value, owner) {
23
- return this.map.get(value)?.owner === nameOf(owner);
24
- }
25
- toArray() {
26
- return Array.from(this.map.values());
27
- }
28
- findProviders(type) {
29
- const providers = this.toArray();
30
- if (!type) {
31
- return providers;
32
- }
33
- type = type.toLowerCase();
34
- if (this.get(type)) {
35
- return [this.get(type)];
36
- }
37
- const proposedProviders = providers.filter((provider) => {
38
- return provider.name.toLowerCase().includes(type) || provider.value.includes(type);
39
- });
40
- return proposedProviders.length ? proposedProviders : providers;
41
- }
42
- };
43
- ProvidersInfoService = __decorate([
44
- Injectable()
45
- ], ProvidersInfoService);
46
- export { ProvidersInfoService };