Skip to content

Commit 42a04c0

Browse files
committed
feat(cli): add init-options command to display available init options for external tools
- Implemented `InitOptionsCommand` to provide detailed options for the `init` command. - Replaced old `InitCmd.spec.ts` tests with a new structure and approach. - Updated commands registry to include `InitOptionsCommand`.
1 parent e028d04 commit 42a04c0

File tree

5 files changed

+28
-145
lines changed

5 files changed

+28
-145
lines changed

packages/cli/src/commands/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import {AddCmd} from "./add/AddCmd.js";
22
import {GenerateCmd} from "./generate/GenerateCmd.js";
33
import {InitCmd} from "./init/InitCmd.js";
4+
import {InitOptionsCommand} from "./init/InitOptionsCmd.js";
45
import {McpCommand} from "./mcp/McpCommand.js";
56
import {RunCmd} from "./run/RunCmd.js";
67
import {CreateTemplateCommand} from "./template/CreateTemplateCommand.js";
78
import {UpdateCmd} from "./update/UpdateCmd.js";
89

9-
export default [AddCmd, InitCmd, GenerateCmd, UpdateCmd, RunCmd, CreateTemplateCommand, McpCommand];
10+
export default [AddCmd, InitCmd, InitOptionsCommand, GenerateCmd, UpdateCmd, RunCmd, CreateTemplateCommand, McpCommand];

packages/cli/src/commands/init/InitCmd.spec.ts

Lines changed: 0 additions & 139 deletions
This file was deleted.

packages/cli/src/commands/init/InitCmd.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ import {TEMPLATE_DIR} from "../../constants/index.js";
2626
import {exec} from "../../fn/exec.js";
2727
import {render} from "../../fn/render.js";
2828
import {taskOutput} from "../../fn/taskOutput.js";
29-
import {ArchitectureConvention} from "../../interfaces/ArchitectureConvention.js";
30-
import {type InitCmdContext, PlatformType} from "../../interfaces/index.js";
29+
import {type InitCmdContext} from "../../interfaces/index.js";
3130
import type {InitOptions} from "../../interfaces/InitCmdOptions.js";
32-
import {ProjectConvention} from "../../interfaces/ProjectConvention.js";
3331
import {PlatformsModule} from "../../platforms/PlatformsModule.js";
3432
import {RuntimesModule} from "../../runtimes/RuntimesModule.js";
3533
import {BunRuntime} from "../../runtimes/supports/BunRuntime.js";
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import {command} from "@tsed/cli-core";
2+
import {s} from "@tsed/schema";
3+
4+
import {InitSchema} from "./config/InitSchema.js";
5+
6+
export const InitOptionsCommand = command({
7+
name: "init-options",
8+
description: "Display available options for Ts.ED init command for external tool",
9+
disableReadUpPkg: true,
10+
inputSchema: s.object({
11+
indent: s.number().default(0).description("Json indentation value").opt("-i, --indent <indent>")
12+
}),
13+
handler(data) {
14+
console.log(
15+
JSON.stringify(
16+
InitSchema().toJSON({
17+
useAlias: false,
18+
customKeys: true
19+
}),
20+
null,
21+
data.indent
22+
)
23+
);
24+
}
25+
}).token();

packages/cli/src/commands/init/config/InitSchema.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,5 +312,3 @@ export const InitSchema = () =>
312312
skipPrompt: s.boolean().optional().default(false).description("Skip the prompt installation").opt("-s, --skip-prompt")
313313
})
314314
.unknown();
315-
316-
// export type InitOptions = s.infer<ReturnType<typeof InitSchema>>;

0 commit comments

Comments
 (0)