@tsed/cli 7.0.0-beta.1 → 7.0.0-beta.11

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 (127) hide show
  1. package/lib/esm/bin/ts-mode.js +10 -0
  2. package/lib/esm/bin/tsed.js +4 -2
  3. package/lib/esm/commands/add/AddCmd.js +2 -1
  4. package/lib/esm/commands/generate/GenerateCmd.js +5 -7
  5. package/lib/esm/commands/index.js +3 -1
  6. package/lib/esm/commands/init/InitCmd.js +20 -113
  7. package/lib/esm/commands/init/InitOptionsCmd.js +17 -0
  8. package/lib/esm/commands/init/config/FeaturesPrompt.js +35 -39
  9. package/lib/esm/commands/init/config/InitSchema.js +337 -0
  10. package/lib/esm/commands/init/prompts/getFeaturesPrompt.js +1 -1
  11. package/lib/esm/commands/mcp/McpCommand.js +15 -0
  12. package/lib/esm/commands/mcp/resources/index.js +4 -0
  13. package/lib/esm/commands/mcp/resources/initOptionsResource.js +93 -0
  14. package/lib/esm/commands/mcp/resources/projectInfoResource.js +43 -0
  15. package/lib/esm/commands/mcp/resources/serverInfoResource.js +40 -0
  16. package/lib/esm/commands/mcp/schema/InitMCPSchema.js +9 -0
  17. package/lib/esm/commands/mcp/schema/ProjectPreferencesSchema.js +16 -0
  18. package/lib/esm/commands/mcp/tools/generateTool.js +105 -0
  19. package/lib/esm/commands/mcp/tools/getTemplateTool.js +47 -0
  20. package/lib/esm/commands/mcp/tools/index.js +6 -0
  21. package/lib/esm/commands/mcp/tools/initProjectTool.js +64 -0
  22. package/lib/esm/commands/mcp/tools/listTemplatesTool.js +37 -0
  23. package/lib/esm/commands/mcp/tools/setWorkspaceTool.js +64 -0
  24. package/lib/esm/commands/run/RunCmd.js +4 -1
  25. package/lib/esm/commands/template/CreateTemplateCommand.js +2 -1
  26. package/lib/esm/commands/update/UpdateCmd.js +3 -4
  27. package/lib/esm/index.js +3 -0
  28. package/lib/esm/processors/transformConfigFile.js +1 -1
  29. package/lib/esm/processors/transformServerFile.js +5 -7
  30. package/lib/esm/services/CliProjectService.js +7 -3
  31. package/lib/esm/services/CliStats.js +45 -0
  32. package/lib/esm/services/CliTemplatesService.js +13 -4
  33. package/lib/esm/templates/agents.template.js +17 -0
  34. package/lib/esm/templates/asyncFactory.template.js +4 -3
  35. package/lib/esm/templates/barrels.template.js +1 -8
  36. package/lib/esm/templates/command.template.js +6 -3
  37. package/lib/esm/templates/controller.template.js +7 -0
  38. package/lib/esm/templates/decorator.template.js +22 -11
  39. package/lib/esm/templates/dockerfile.template.js +5 -0
  40. package/lib/esm/templates/exception-filter.template.js +1 -0
  41. package/lib/esm/templates/factory.template.js +4 -3
  42. package/lib/esm/templates/index.command.template.js +1 -1
  43. package/lib/esm/templates/index.controller.template.js +12 -8
  44. package/lib/esm/templates/index.js +1 -0
  45. package/lib/esm/templates/index.logger.template.js +0 -1
  46. package/lib/esm/templates/interceptor.template.js +1 -0
  47. package/lib/esm/templates/interface.template.js +1 -0
  48. package/lib/esm/templates/middleware.template.js +14 -4
  49. package/lib/esm/templates/model.template.js +1 -0
  50. package/lib/esm/templates/module.template.js +1 -0
  51. package/lib/esm/templates/pipe.template.js +1 -0
  52. package/lib/esm/templates/prisma.service.template.js +1 -0
  53. package/lib/esm/templates/repository.template.js +1 -0
  54. package/lib/esm/templates/response-filter.template.js +1 -0
  55. package/lib/esm/templates/service.template.js +1 -0
  56. package/lib/esm/templates/value.template.js +1 -0
  57. package/lib/esm/utils/resolveSchema.js +17 -0
  58. package/lib/esm/utils/summarizeSchema.js +24 -0
  59. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  60. package/lib/types/bin/ts-mode.d.ts +1 -0
  61. package/lib/types/bin/tsed.d.ts +1 -1
  62. package/lib/types/commands/add/AddCmd.d.ts +2 -2
  63. package/lib/types/commands/generate/GenerateCmd.d.ts +2 -2
  64. package/lib/types/commands/index.d.ts +103 -1
  65. package/lib/types/commands/init/InitCmd.d.ts +4 -6
  66. package/lib/types/commands/init/InitOptionsCmd.d.ts +52 -0
  67. package/lib/types/commands/init/config/FeaturesPrompt.d.ts +26 -32
  68. package/lib/types/commands/init/config/InitSchema.d.ts +18 -0
  69. package/lib/types/commands/mcp/McpCommand.d.ts +52 -0
  70. package/lib/types/commands/mcp/resources/index.d.ts +2 -0
  71. package/lib/types/commands/mcp/resources/initOptionsResource.d.ts +1 -0
  72. package/lib/types/commands/mcp/resources/projectInfoResource.d.ts +1 -0
  73. package/lib/types/commands/mcp/resources/serverInfoResource.d.ts +1 -0
  74. package/lib/types/commands/mcp/schema/InitMCPSchema.d.ts +5 -0
  75. package/lib/types/commands/mcp/schema/ProjectPreferencesSchema.d.ts +9 -0
  76. package/lib/types/commands/mcp/tools/generateTool.d.ts +116 -0
  77. package/lib/types/commands/mcp/tools/getTemplateTool.d.ts +114 -0
  78. package/lib/types/commands/mcp/tools/index.d.ts +345 -0
  79. package/lib/types/commands/mcp/tools/initProjectTool.d.ts +116 -0
  80. package/lib/types/commands/mcp/tools/listTemplatesTool.d.ts +114 -0
  81. package/lib/types/commands/mcp/tools/setWorkspaceTool.d.ts +119 -0
  82. package/lib/types/commands/template/CreateTemplateCommand.d.ts +4 -4
  83. package/lib/types/commands/update/UpdateCmd.d.ts +3 -2
  84. package/lib/types/index.d.ts +3 -0
  85. package/lib/types/interfaces/InitCmdOptions.d.ts +1 -1
  86. package/lib/types/pipes/SymbolNamePipe.d.ts +1 -1
  87. package/lib/types/services/CliProjectService.d.ts +1 -1
  88. package/lib/types/services/CliStats.d.ts +36 -0
  89. package/lib/types/services/CliTemplatesService.d.ts +6 -5
  90. package/lib/types/templates/agents.template.d.ts +17 -0
  91. package/lib/types/templates/asyncFactory.template.d.ts +2 -1
  92. package/lib/types/templates/barrels.template.d.ts +2 -1
  93. package/lib/types/templates/command.template.d.ts +2 -1
  94. package/lib/types/templates/config.template.d.ts +2 -1
  95. package/lib/types/templates/controller.template.d.ts +2 -1
  96. package/lib/types/templates/decorator.template.d.ts +2 -1
  97. package/lib/types/templates/docker-compose.template.d.ts +2 -1
  98. package/lib/types/templates/exception-filter.template.d.ts +2 -1
  99. package/lib/types/templates/factory.template.d.ts +2 -1
  100. package/lib/types/templates/index.command.template.d.ts +2 -1
  101. package/lib/types/templates/index.config.utils.template.d.ts +2 -1
  102. package/lib/types/templates/index.controller.template.d.ts +2 -1
  103. package/lib/types/templates/index.d.ts +1 -0
  104. package/lib/types/templates/index.logger.template.d.ts +3 -2
  105. package/lib/types/templates/index.template.d.ts +2 -1
  106. package/lib/types/templates/interceptor.template.d.ts +2 -1
  107. package/lib/types/templates/interface.template.d.ts +2 -1
  108. package/lib/types/templates/middleware.template.d.ts +2 -1
  109. package/lib/types/templates/model.template.d.ts +2 -1
  110. package/lib/types/templates/module.template.d.ts +2 -1
  111. package/lib/types/templates/pipe.template.d.ts +2 -1
  112. package/lib/types/templates/prisma.service.template.d.ts +2 -1
  113. package/lib/types/templates/readme.template.d.ts +2 -1
  114. package/lib/types/templates/repository.template.d.ts +2 -1
  115. package/lib/types/templates/response-filter.template.d.ts +2 -1
  116. package/lib/types/templates/server.template.d.ts +2 -1
  117. package/lib/types/templates/service.template.d.ts +2 -1
  118. package/lib/types/templates/tsconfig.spec.template.d.ts +2 -1
  119. package/lib/types/templates/value.template.d.ts +2 -1
  120. package/lib/types/utils/defineTemplate.d.ts +14 -3
  121. package/lib/types/utils/resolveSchema.d.ts +2 -0
  122. package/lib/types/utils/summarizeSchema.d.ts +8 -0
  123. package/package.json +18 -13
  124. package/templates/views/home.ejs +347 -0
  125. package/lib/esm/commands/init/config/InitFileSchema.js +0 -49
  126. package/lib/types/commands/init/config/InitFileSchema.d.ts +0 -49
  127. package/templates/views/swagger.ejs +0 -100
@@ -0,0 +1,10 @@
1
+ if (process.env.CLI_MODE === "ts") {
2
+ try {
3
+ await import("@swc-node/register/esm-register");
4
+ }
5
+ catch (error) {
6
+ console.error("CLI_MODE=ts requires '@swc-node/register'. Install it and @swc/core to continue.");
7
+ process.env.CLI_MODE = undefined;
8
+ }
9
+ }
10
+ export {};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "@swc-node/register/esm-register";
2
+ import "./ts-mode.js";
3
3
  import { register } from "node:module";
4
4
  import { join } from "node:path";
5
5
  import { pathToFileURL } from "node:url";
@@ -15,7 +15,7 @@ register(pathToFileURL(join(import.meta.dirname, `../loaders/alias.hook.${EXT}`)
15
15
  },
16
16
  transferList: []
17
17
  });
18
- const { commands, CliCore, PKG, TEMPLATE_DIR, ArchitectureConvention, ProjectConvention } = await import("../index.js");
18
+ const { tools, commands, resources, CliCore, PKG, TEMPLATE_DIR, ArchitectureConvention, ProjectConvention } = await import("../index.js");
19
19
  CliCore.bootstrap({
20
20
  name: "tsed",
21
21
  pkg: PKG,
@@ -24,6 +24,8 @@ CliCore.bootstrap({
24
24
  updateNotifier: true,
25
25
  checkPrecondition: true,
26
26
  commands,
27
+ tools,
28
+ resources,
27
29
  defaultProjectPreferences() {
28
30
  return {
29
31
  convention: ProjectConvention.DEFAULT,
@@ -41,7 +41,8 @@ export class AddCmd {
41
41
  ];
42
42
  }
43
43
  }
44
- command(AddCmd, {
44
+ command({
45
+ token: AddCmd,
45
46
  name: "add",
46
47
  description: "Add cli plugin to the current project",
47
48
  args: {
@@ -21,11 +21,8 @@ export class GenerateCmd {
21
21
  async $prompt(data) {
22
22
  data = addContextMethods(data);
23
23
  const templates = this.templates.find();
24
- const templatesPrompts = await Promise.all(templates
25
- .filter((template) => template.prompts)
26
- .map((template) => {
27
- return template.prompts(data);
28
- }));
24
+ const templatesPrompts = await Promise.all(templates.filter((template) => template.prompts).map((template) => template.prompts(data)));
25
+ const additionalPrompts = templatesPrompts.flat();
29
26
  return [
30
27
  {
31
28
  type: "autocomplete",
@@ -42,7 +39,7 @@ export class GenerateCmd {
42
39
  default: data.getName,
43
40
  when: !data.name
44
41
  },
45
- ...templatesPrompts.flat()
42
+ ...additionalPrompts
46
43
  ];
47
44
  }
48
45
  $mapContext(ctx) {
@@ -63,7 +60,8 @@ export class GenerateCmd {
63
60
  ];
64
61
  }
65
62
  }
66
- command(GenerateCmd, {
63
+ command({
64
+ token: GenerateCmd,
67
65
  name: "generate",
68
66
  alias: "g",
69
67
  description: "Generate a new provider class",
@@ -1,7 +1,9 @@
1
1
  import { AddCmd } from "./add/AddCmd.js";
2
2
  import { GenerateCmd } from "./generate/GenerateCmd.js";
3
3
  import { InitCmd } from "./init/InitCmd.js";
4
+ import { InitOptionsCommand } from "./init/InitOptionsCmd.js";
5
+ import { McpCommand } from "./mcp/McpCommand.js";
4
6
  import { RunCmd } from "./run/RunCmd.js";
5
7
  import { CreateTemplateCommand } from "./template/CreateTemplateCommand.js";
6
8
  import { UpdateCmd } from "./update/UpdateCmd.js";
7
- export default [AddCmd, InitCmd, GenerateCmd, UpdateCmd, RunCmd, CreateTemplateCommand];
9
+ export default [AddCmd, InitCmd, InitOptionsCommand, GenerateCmd, UpdateCmd, RunCmd, CreateTemplateCommand, McpCommand];
@@ -1,23 +1,20 @@
1
1
  import { basename, join } from "node:path";
2
- import { CliExeca, CliFs, CliLoadFile, cliPackageJson, CliPlugins, command, Configuration, createSubTasks, createTasksRunner, inject, PackageManager, PackageManagersModule, ProjectPackageJson } from "@tsed/cli-core";
2
+ import { CliExeca, CliFs, CliLoadFile, cliPackageJson, CliPlugins, command, Configuration, createSubTasks, createTasksRunner, inject, PackageManagersModule, ProjectPackageJson } from "@tsed/cli-core";
3
3
  import { isString } from "@tsed/core";
4
4
  import { constant } from "@tsed/di";
5
5
  import { $asyncAlter } from "@tsed/hooks";
6
6
  import { kebabCase } from "change-case";
7
- import { DEFAULT_TSED_TAGS, TEMPLATE_DIR } from "../../constants/index.js";
7
+ import { TEMPLATE_DIR } from "../../constants/index.js";
8
8
  import { exec } from "../../fn/exec.js";
9
9
  import { render } from "../../fn/render.js";
10
10
  import { taskOutput } from "../../fn/taskOutput.js";
11
- import { ArchitectureConvention } from "../../interfaces/ArchitectureConvention.js";
12
- import { PlatformType } from "../../interfaces/index.js";
13
- import { ProjectConvention } from "../../interfaces/ProjectConvention.js";
14
11
  import { PlatformsModule } from "../../platforms/PlatformsModule.js";
15
12
  import { RuntimesModule } from "../../runtimes/RuntimesModule.js";
16
13
  import { BunRuntime } from "../../runtimes/supports/BunRuntime.js";
17
14
  import { NodeRuntime } from "../../runtimes/supports/NodeRuntime.js";
18
15
  import { CliProjectService } from "../../services/CliProjectService.js";
19
16
  import { FeaturesMap, FeatureType } from "./config/FeaturesPrompt.js";
20
- import { InitFileSchema } from "./config/InitFileSchema.js";
17
+ import { InitSchema } from "./config/InitSchema.js";
21
18
  import { mapToContext } from "./mappers/mapToContext.js";
22
19
  import { getFeaturesPrompt } from "./prompts/getFeaturesPrompt.js";
23
20
  export class InitCmd {
@@ -34,45 +31,14 @@ export class InitCmd {
34
31
  this.execa = inject(CliExeca);
35
32
  this.fs = inject(CliFs);
36
33
  }
37
- checkPrecondition(ctx) {
38
- const isValid = (types, value) => (value ? Object.values(types).includes(value) : true);
39
- if (!isValid(PlatformType, ctx.platform)) {
40
- throw new Error(`Invalid selected platform: ${ctx.platform}. Possible values: ${Object.values(PlatformType).join(", ")}.`);
41
- }
42
- if (!isValid(ArchitectureConvention, ctx.architecture)) {
43
- throw new Error(`Invalid selected architecture: ${ctx.architecture}. Possible values: ${Object.values(ArchitectureConvention).join(", ")}.`);
44
- }
45
- if (!isValid(ProjectConvention, ctx.convention)) {
46
- throw new Error(`Invalid selected convention: ${ctx.convention}. Possible values: ${Object.values(ProjectConvention).join(", ")}.`);
47
- }
48
- const runtimes = this.runtimes.list();
49
- if (!runtimes.includes(ctx.runtime)) {
50
- throw new Error(`Invalid selected runtime: ${ctx.runtime}. Possible values: ${runtimes.join(", ")}.`);
51
- }
52
- const managers = this.packageManagers.list();
53
- if (!managers.includes(ctx.packageManager)) {
54
- throw new Error(`Invalid selected package manager: ${ctx.packageManager}. Possible values: ${managers.join(", ")}.`);
55
- }
56
- if (ctx.features) {
57
- ctx.features.forEach((value) => {
58
- const feature = FeaturesMap[value.toLowerCase()];
59
- if (!feature) {
60
- throw new Error(`Invalid selected feature: ${value}. Possible values: ${Object.values(FeatureType).join(", ")}.`);
61
- }
62
- });
63
- }
64
- }
65
- async $beforePrompt(initialOptions) {
34
+ async $prompt(initialOptions) {
66
35
  if (initialOptions.file) {
67
- const file = join(this.packageJson.dir, initialOptions.file);
68
- return {
36
+ const file = join(this.packageJson.cwd, initialOptions.file);
37
+ initialOptions = {
69
38
  ...initialOptions,
70
- ...(await this.cliLoadFile.loadFile(file, InitFileSchema))
39
+ ...(await this.cliLoadFile.loadFile(file, InitSchema()))
71
40
  };
72
41
  }
73
- return initialOptions;
74
- }
75
- $prompt(initialOptions) {
76
42
  if (initialOptions.skipPrompt) {
77
43
  return [];
78
44
  }
@@ -108,14 +74,14 @@ export class InitCmd {
108
74
  srcDir: constant("project.srcDir", "src")
109
75
  };
110
76
  }
111
- async $beforeExec(ctx) {
112
- this.fs.ensureDirSync(this.packageJson.dir);
77
+ async $exec(ctx) {
78
+ this.fs.ensureDirSync(this.packageJson.cwd);
113
79
  ctx.projectName && (this.packageJson.name = ctx.projectName);
114
80
  ctx.packageManager && this.packageJson.setPreference("packageManager", ctx.packageManager);
115
81
  ctx.runtime && this.packageJson.setPreference("runtime", ctx.runtime);
116
82
  ctx.architecture && this.packageJson.setPreference("architecture", ctx.architecture);
117
83
  ctx.convention && this.packageJson.setPreference("convention", ctx.convention);
118
- ctx.platform && this.packageJson.setPreference("platform", ctx.convention);
84
+ ctx.platform && this.packageJson.setPreference("platform", ctx.platform);
119
85
  ctx.GH_TOKEN && this.packageJson.setGhToken(ctx.GH_TOKEN);
120
86
  await createTasksRunner([
121
87
  {
@@ -148,9 +114,6 @@ export class InitCmd {
148
114
  task: createSubTasks(() => this.cliPlugins.addPluginsDependencies(ctx), { ...ctx, concurrent: false })
149
115
  }
150
116
  ], ctx);
151
- }
152
- async $exec(ctx) {
153
- this.checkPrecondition(ctx);
154
117
  const runtime = this.runtimes.get();
155
118
  ctx = {
156
119
  ...ctx,
@@ -213,15 +176,15 @@ export class InitCmd {
213
176
  ];
214
177
  }
215
178
  resolveRootDir(ctx) {
216
- const rootDirName = kebabCase(ctx.projectName || basename(this.packageJson.dir));
217
- if (this.packageJson.dir.endsWith(rootDirName)) {
179
+ const rootDirName = kebabCase(ctx.projectName || basename(this.packageJson.cwd));
180
+ if (this.packageJson.cwd.endsWith(rootDirName)) {
218
181
  ctx.projectName = ctx.projectName || rootDirName;
219
182
  ctx.root = ".";
220
183
  return;
221
184
  }
222
185
  ctx.projectName = ctx.projectName || rootDirName;
223
186
  if (ctx.root && ctx.root !== ".") {
224
- this.packageJson.dir = join(this.packageJson.dir, rootDirName);
187
+ this.packageJson.setCWD(join(this.packageJson.cwd, rootDirName));
225
188
  ctx.root = ".";
226
189
  }
227
190
  }
@@ -230,7 +193,7 @@ export class InitCmd {
230
193
  if (ctx.eslint || ctx.testing) {
231
194
  const runtime = this.runtimes.get();
232
195
  const scripts = {
233
- test: [ctx.eslint && runtime.run("test:lint"), ctx.testing && runtime.run("test:coverage")].filter(Boolean).join("&&")
196
+ test: [ctx.eslint && runtime.run("test:lint"), ctx.testing && runtime.run("test:coverage")].filter(Boolean).join(" && ")
234
197
  };
235
198
  this.packageJson.addScripts(scripts);
236
199
  }
@@ -311,12 +274,13 @@ export class InitCmd {
311
274
  "index",
312
275
  "index.config.util",
313
276
  "index.logger",
314
- "index.controller",
277
+ ctx.swagger && "index.controller",
315
278
  ctx.commands && "index.command",
316
279
  "barrels",
317
280
  "readme",
281
+ "agents",
318
282
  `pm2.${pm2}`,
319
- ctx.swagger && "/views/swagger.ejs",
283
+ "/views/home.ejs",
320
284
  ...runtime.files()
321
285
  ].map((id) => {
322
286
  return id && render(id, ctx);
@@ -355,67 +319,10 @@ export class InitCmd {
355
319
  taskOutput(`Plugins files rendered (${Date.now() - startTime}ms)`);
356
320
  }
357
321
  }
358
- command(InitCmd, {
322
+ command({
323
+ token: InitCmd,
359
324
  name: "init",
360
325
  description: "Init a new Ts.ED project",
361
- args: {
362
- root: {
363
- type: String,
364
- defaultValue: ".",
365
- description: "Root directory to initialize the Ts.ED project"
366
- }
367
- },
368
- options: {
369
- "-n, --project-name <projectName>": {
370
- type: String,
371
- defaultValue: "",
372
- description: "Set the project name. By default, the project is the same as the name directory."
373
- },
374
- "-a, --arch <architecture>": {
375
- type: String,
376
- defaultValue: ArchitectureConvention.DEFAULT,
377
- description: `Set the default architecture convention (${ArchitectureConvention.DEFAULT} or ${ArchitectureConvention.FEATURE})`
378
- },
379
- "-c, --convention <convention>": {
380
- type: String,
381
- defaultValue: ProjectConvention.DEFAULT,
382
- description: `Set the default project convention (${ArchitectureConvention.DEFAULT} or ${ArchitectureConvention.FEATURE})`
383
- },
384
- "-p, --platform <platform>": {
385
- type: String,
386
- defaultValue: PlatformType.EXPRESS,
387
- description: "Set the default platform for Ts.ED (express, koa or fastify)"
388
- },
389
- "--features <features...>": {
390
- type: Array,
391
- itemType: String,
392
- defaultValue: [],
393
- description: "List of the Ts.ED features."
394
- },
395
- "--runtime <runtime>": {
396
- itemType: String,
397
- defaultValue: "node",
398
- description: "The default runtime used to run the project"
399
- },
400
- "-m, --package-manager <packageManager>": {
401
- itemType: String,
402
- defaultValue: PackageManager.YARN,
403
- description: "The default package manager to install the project"
404
- },
405
- "-t, --tsed-version <version>": {
406
- type: String,
407
- defaultValue: DEFAULT_TSED_TAGS,
408
- description: "Use a specific version of Ts.ED (format: 5.x.x)."
409
- },
410
- "-f, --file <path>": {
411
- type: String,
412
- description: "Location of a file in which the features are defined."
413
- },
414
- "-s, --skip-prompt": {
415
- type: Boolean,
416
- defaultValue: false,
417
- description: "Skip the prompt."
418
- }
419
- },
326
+ inputSchema: InitSchema,
420
327
  disableReadUpPkg: true
421
328
  });
@@ -0,0 +1,17 @@
1
+ import { command } from "@tsed/cli-core";
2
+ import { s } from "@tsed/schema";
3
+ import { InitSchema } from "./config/InitSchema.js";
4
+ export const InitOptionsCommand = command({
5
+ name: "init-options",
6
+ description: "Display available options for Ts.ED init command for external tool",
7
+ disableReadUpPkg: true,
8
+ inputSchema: s.object({
9
+ indent: s.number().default(0).description("Json indentation value").opt("-i, --indent <indent>")
10
+ }),
11
+ handler(data) {
12
+ console.log(JSON.stringify(InitSchema().toJSON({
13
+ useAlias: false,
14
+ customKeys: true
15
+ }), null, data.indent));
16
+ }
17
+ }).token();
@@ -9,7 +9,7 @@ export var FeatureType;
9
9
  FeatureType["PASSPORTJS"] = "passportjs";
10
10
  FeatureType["CONFIG"] = "config";
11
11
  FeatureType["COMMANDS"] = "commands";
12
- FeatureType["DB"] = "db";
12
+ FeatureType["ORM"] = "orm";
13
13
  FeatureType["DOC"] = "doc";
14
14
  // CONFIG
15
15
  FeatureType["CONFIG_ENVS"] = "config:envs";
@@ -22,35 +22,35 @@ export var FeatureType;
22
22
  FeatureType["CONFIG_VAULT"] = "config:vault:premium";
23
23
  FeatureType["CONFIG_POSTGRES"] = "config:postgres:premium";
24
24
  // DOC
25
- FeatureType["SWAGGER"] = "swagger";
26
- FeatureType["SCALAR"] = "scalar";
25
+ FeatureType["SWAGGER"] = "doc:swagger";
26
+ FeatureType["SCALAR"] = "doc:scalar";
27
27
  // ORM
28
- FeatureType["PRISMA"] = "prisma";
29
- FeatureType["MONGOOSE"] = "mongoose";
28
+ FeatureType["PRISMA"] = "orm:prisma";
29
+ FeatureType["MONGOOSE"] = "orm:mongoose";
30
30
  // TYPEORM
31
- FeatureType["TYPEORM"] = "typeorm";
32
- FeatureType["TYPEORM_MYSQL"] = "typeorm:mysql";
33
- FeatureType["TYPEORM_MARIADB"] = "typeorm:mariadb";
34
- FeatureType["TYPEORM_POSTGRES"] = "typeorm:postgres";
35
- FeatureType["TYPEORM_COCKROACHDB"] = "typeorm:cockroachdb";
36
- FeatureType["TYPEORM_SQLITE"] = "typeorm:sqlite";
37
- FeatureType["TYPEORM_BETTER_SQLITE3"] = "typeorm:better-sqlite3";
38
- FeatureType["TYPEORM_CORDOVA"] = "typeorm:cordova";
39
- FeatureType["TYPEORM_NATIVESCRIPT"] = "typeorm:nativescript";
40
- FeatureType["TYPEORM_ORACLE"] = "typeorm:oracle";
41
- FeatureType["TYPEORM_MSSQL"] = "typeorm:mssql";
42
- FeatureType["TYPEORM_MONGODB"] = "typeorm:mongodb";
43
- FeatureType["TYPEORM_SQLJS"] = "typeorm:sqljs";
44
- FeatureType["TYPEORM_REACTNATIVE"] = "typeorm:reactnative";
45
- FeatureType["TYPEORM_EXPO"] = "typeorm:expo";
31
+ FeatureType["TYPEORM"] = "orm:typeorm";
32
+ FeatureType["TYPEORM_MYSQL"] = "orm:typeorm:mysql";
33
+ FeatureType["TYPEORM_MARIADB"] = "orm:typeorm:mariadb";
34
+ FeatureType["TYPEORM_POSTGRES"] = "orm:typeorm:postgres";
35
+ FeatureType["TYPEORM_COCKROACHDB"] = "orm:typeorm:cockroachdb";
36
+ FeatureType["TYPEORM_SQLITE"] = "orm:typeorm:sqlite";
37
+ FeatureType["TYPEORM_BETTER_SQLITE3"] = "orm:typeorm:better-sqlite3";
38
+ FeatureType["TYPEORM_CORDOVA"] = "orm:typeorm:cordova";
39
+ FeatureType["TYPEORM_NATIVESCRIPT"] = "orm:typeorm:nativescript";
40
+ FeatureType["TYPEORM_ORACLE"] = "orm:typeorm:oracle";
41
+ FeatureType["TYPEORM_MSSQL"] = "orm:typeorm:mssql";
42
+ FeatureType["TYPEORM_MONGODB"] = "orm:typeorm:mongodb";
43
+ FeatureType["TYPEORM_SQLJS"] = "orm:typeorm:sqljs";
44
+ FeatureType["TYPEORM_REACTNATIVE"] = "orm:typeorm:reactnative";
45
+ FeatureType["TYPEORM_EXPO"] = "orm:typeorm:expo";
46
46
  // TESTING & LINTER
47
47
  FeatureType["TESTING"] = "testing";
48
- FeatureType["JEST"] = "jest";
49
- FeatureType["VITEST"] = "vitest";
48
+ FeatureType["JEST"] = "testing:jest";
49
+ FeatureType["VITEST"] = "testing:vitest";
50
50
  FeatureType["LINTER"] = "linter";
51
- FeatureType["ESLINT"] = "eslint";
52
- FeatureType["LINT_STAGED"] = "lintstaged";
53
- FeatureType["PRETTIER"] = "prettier";
51
+ FeatureType["ESLINT"] = "linter:eslint";
52
+ FeatureType["LINT_STAGED"] = "linter:lintstaged";
53
+ FeatureType["PRETTIER"] = "linter:prettier";
54
54
  })(FeatureType || (FeatureType = {}));
55
55
  export const FeaturesMap = {
56
56
  [PlatformType.EXPRESS]: {
@@ -77,7 +77,7 @@ export const FeaturesMap = {
77
77
  [FeatureType.DOC]: {
78
78
  name: "Documentation"
79
79
  },
80
- [FeatureType.DB]: {
80
+ [FeatureType.ORM]: {
81
81
  name: "Database"
82
82
  },
83
83
  [FeatureType.PASSPORTJS]: {
@@ -127,9 +127,6 @@ export const FeaturesMap = {
127
127
  name: "Commands",
128
128
  dependencies: {
129
129
  "@tsed/cli-core": "{{cliVersion}}"
130
- },
131
- devDependencies: {
132
- "@types/inquirer": "^8.2.4"
133
130
  }
134
131
  },
135
132
  [ProjectConvention.DEFAULT]: {
@@ -363,14 +360,13 @@ export const FeaturesMap = {
363
360
  checked: false
364
361
  }
365
362
  };
366
- export const FrameworksPrompt = {
367
- message: "Choose the target Framework:",
368
- type: "list",
369
- name: "platform",
370
- choices: [PlatformType.EXPRESS, PlatformType.KOA, PlatformType.FASTIFY]
371
- };
372
363
  export const FeaturesPrompt = (availableRuntimes, availablePackageManagers) => [
373
- FrameworksPrompt,
364
+ {
365
+ message: "Choose the target Framework:",
366
+ type: "list",
367
+ name: "platform",
368
+ choices: [PlatformType.EXPRESS, PlatformType.KOA, PlatformType.FASTIFY]
369
+ },
374
370
  {
375
371
  message: "Choose the architecture for your project:",
376
372
  type: "list",
@@ -386,11 +382,11 @@ export const FeaturesPrompt = (availableRuntimes, availablePackageManagers) => [
386
382
  {
387
383
  type: "checkbox",
388
384
  name: "features",
389
- message: "Check the features needed for your project",
385
+ message: "Choose the features needed for your project",
390
386
  choices: [
391
387
  FeatureType.CONFIG,
392
388
  FeatureType.GRAPHQL,
393
- FeatureType.DB,
389
+ FeatureType.ORM,
394
390
  FeatureType.PASSPORTJS,
395
391
  FeatureType.SOCKETIO,
396
392
  FeatureType.DOC,
@@ -428,7 +424,7 @@ export const FeaturesPrompt = (availableRuntimes, availablePackageManagers) => [
428
424
  message: "Choose a ORM manager",
429
425
  type: "list",
430
426
  name: "featuresDB",
431
- when: hasFeature(FeatureType.DB),
427
+ when: hasFeature(FeatureType.ORM),
432
428
  choices: [FeatureType.PRISMA, FeatureType.MONGOOSE, FeatureType.TYPEORM]
433
429
  },
434
430
  {