@tsed/cli 7.0.0-beta.10 → 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 (43) hide show
  1. package/lib/esm/commands/generate/GenerateCmd.js +3 -6
  2. package/lib/esm/commands/init/config/FeaturesPrompt.js +0 -3
  3. package/lib/esm/templates/command.template.js +5 -3
  4. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  5. package/lib/types/commands/add/AddCmd.d.ts +2 -2
  6. package/lib/types/commands/generate/GenerateCmd.d.ts +2 -39
  7. package/lib/types/commands/index.d.ts +6 -6
  8. package/lib/types/commands/init/InitCmd.d.ts +3 -2
  9. package/lib/types/commands/init/InitOptionsCmd.d.ts +3 -3
  10. package/lib/types/commands/mcp/McpCommand.d.ts +3 -3
  11. package/lib/types/commands/template/CreateTemplateCommand.d.ts +4 -4
  12. package/lib/types/commands/update/UpdateCmd.d.ts +3 -2
  13. package/lib/types/templates/agents.template.d.ts +1 -1
  14. package/lib/types/templates/asyncFactory.template.d.ts +1 -1
  15. package/lib/types/templates/barrels.template.d.ts +1 -1
  16. package/lib/types/templates/command.template.d.ts +1 -1
  17. package/lib/types/templates/config.template.d.ts +1 -1
  18. package/lib/types/templates/controller.template.d.ts +1 -1
  19. package/lib/types/templates/decorator.template.d.ts +1 -1
  20. package/lib/types/templates/docker-compose.template.d.ts +1 -1
  21. package/lib/types/templates/exception-filter.template.d.ts +1 -1
  22. package/lib/types/templates/factory.template.d.ts +1 -1
  23. package/lib/types/templates/index.command.template.d.ts +1 -1
  24. package/lib/types/templates/index.config.utils.template.d.ts +1 -1
  25. package/lib/types/templates/index.controller.template.d.ts +1 -1
  26. package/lib/types/templates/index.logger.template.d.ts +1 -1
  27. package/lib/types/templates/index.template.d.ts +1 -1
  28. package/lib/types/templates/interceptor.template.d.ts +1 -1
  29. package/lib/types/templates/interface.template.d.ts +1 -1
  30. package/lib/types/templates/middleware.template.d.ts +1 -1
  31. package/lib/types/templates/model.template.d.ts +1 -1
  32. package/lib/types/templates/module.template.d.ts +1 -1
  33. package/lib/types/templates/pipe.template.d.ts +1 -1
  34. package/lib/types/templates/prisma.service.template.d.ts +1 -1
  35. package/lib/types/templates/readme.template.d.ts +1 -1
  36. package/lib/types/templates/repository.template.d.ts +1 -1
  37. package/lib/types/templates/response-filter.template.d.ts +1 -1
  38. package/lib/types/templates/server.template.d.ts +1 -1
  39. package/lib/types/templates/service.template.d.ts +1 -1
  40. package/lib/types/templates/tsconfig.spec.template.d.ts +1 -1
  41. package/lib/types/templates/value.template.d.ts +1 -1
  42. package/lib/types/utils/defineTemplate.d.ts +3 -3
  43. package/package.json +4 -4
@@ -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) {
@@ -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]: {
@@ -8,7 +8,8 @@ export default defineTemplate({
8
8
  outputDir: "{{srcDir}}/bin/commands",
9
9
  render(symbolName) {
10
10
  const symbolParamName = kebabCase(symbolName);
11
- return `import {Command, CommandProvider, QuestionOptions} from "@tsed/cli-core";
11
+ return `import {Command, CommandProvider} from "@tsed/cli-core";
12
+ import type {PromptOptions} from "@tsed/cli-prompts";
12
13
 
13
14
  export interface ${symbolName}Context {
14
15
  }
@@ -24,9 +25,10 @@ export interface ${symbolName}Context {
24
25
  })
25
26
  export class ${symbolName} implements CommandProvider {
26
27
  /**
27
- * Ask questions with Inquirer. Return an empty array or don't implement the method to skip this step
28
+ * Ask questions with the Ts.ED prompt runner (powered by @clack/prompts).
29
+ * Return an empty array or don't implement the method to skip this step.
28
30
  */
29
- async $prompt(initialOptions: Partial<${symbolName}Context>): Promise<QuestionOptions> {
31
+ async $prompt(initialOptions: Partial<${symbolName}Context>): Promise<PromptOptions[]> {
30
32
  return [];
31
33
  }
32
34