@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.
- package/lib/esm/commands/generate/GenerateCmd.js +3 -6
- package/lib/esm/commands/init/config/FeaturesPrompt.js +0 -3
- package/lib/esm/templates/command.template.js +5 -3
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/commands/add/AddCmd.d.ts +2 -2
- package/lib/types/commands/generate/GenerateCmd.d.ts +2 -39
- package/lib/types/commands/index.d.ts +6 -6
- package/lib/types/commands/init/InitCmd.d.ts +3 -2
- package/lib/types/commands/init/InitOptionsCmd.d.ts +3 -3
- package/lib/types/commands/mcp/McpCommand.d.ts +3 -3
- package/lib/types/commands/template/CreateTemplateCommand.d.ts +4 -4
- package/lib/types/commands/update/UpdateCmd.d.ts +3 -2
- package/lib/types/templates/agents.template.d.ts +1 -1
- package/lib/types/templates/asyncFactory.template.d.ts +1 -1
- package/lib/types/templates/barrels.template.d.ts +1 -1
- package/lib/types/templates/command.template.d.ts +1 -1
- package/lib/types/templates/config.template.d.ts +1 -1
- package/lib/types/templates/controller.template.d.ts +1 -1
- package/lib/types/templates/decorator.template.d.ts +1 -1
- package/lib/types/templates/docker-compose.template.d.ts +1 -1
- package/lib/types/templates/exception-filter.template.d.ts +1 -1
- package/lib/types/templates/factory.template.d.ts +1 -1
- package/lib/types/templates/index.command.template.d.ts +1 -1
- package/lib/types/templates/index.config.utils.template.d.ts +1 -1
- package/lib/types/templates/index.controller.template.d.ts +1 -1
- package/lib/types/templates/index.logger.template.d.ts +1 -1
- package/lib/types/templates/index.template.d.ts +1 -1
- package/lib/types/templates/interceptor.template.d.ts +1 -1
- package/lib/types/templates/interface.template.d.ts +1 -1
- package/lib/types/templates/middleware.template.d.ts +1 -1
- package/lib/types/templates/model.template.d.ts +1 -1
- package/lib/types/templates/module.template.d.ts +1 -1
- package/lib/types/templates/pipe.template.d.ts +1 -1
- package/lib/types/templates/prisma.service.template.d.ts +1 -1
- package/lib/types/templates/readme.template.d.ts +1 -1
- package/lib/types/templates/repository.template.d.ts +1 -1
- package/lib/types/templates/response-filter.template.d.ts +1 -1
- package/lib/types/templates/server.template.d.ts +1 -1
- package/lib/types/templates/service.template.d.ts +1 -1
- package/lib/types/templates/tsconfig.spec.template.d.ts +1 -1
- package/lib/types/templates/value.template.d.ts +1 -1
- package/lib/types/utils/defineTemplate.d.ts +3 -3
- 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
|
-
|
|
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
|
-
...
|
|
42
|
+
...additionalPrompts
|
|
46
43
|
];
|
|
47
44
|
}
|
|
48
45
|
$mapContext(ctx) {
|
|
@@ -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
|
|
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
|
|
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<
|
|
31
|
+
async $prompt(initialOptions: Partial<${symbolName}Context>): Promise<PromptOptions[]> {
|
|
30
32
|
return [];
|
|
31
33
|
}
|
|
32
34
|
|