@tsed/cli 7.0.0-beta.12 → 7.0.0-beta.14
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/add/AddCmd.js +4 -7
- package/lib/esm/commands/init/InitCmd.js +13 -12
- package/lib/esm/commands/init/config/FeaturesPrompt.js +2 -3
- package/lib/esm/commands/run/RunCmd.js +2 -2
- package/lib/esm/commands/update/UpdateCmd.js +2 -7
- package/lib/esm/templates/command.template.js +1 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/commands/index.d.ts +6 -6
- package/lib/types/commands/init/InitCmd.d.ts +1 -0
- package/lib/types/commands/init/InitOptionsCmd.d.ts +3 -3
- package/lib/types/commands/init/config/FeaturesPrompt.d.ts +24 -8
- package/lib/types/commands/mcp/McpCommand.d.ts +3 -3
- package/lib/types/commands/run/RunCmd.d.ts +2 -2
- package/lib/types/fn/exec.d.ts +1 -1
- package/package.json +6 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CliPlugins, command,
|
|
1
|
+
import { CliPlugins, command, inject, PackageManagersModule, ProjectPackageJson } from "@tsed/cli-core";
|
|
2
2
|
export class AddCmd {
|
|
3
3
|
constructor() {
|
|
4
4
|
this.cliPlugins = inject(CliPlugins);
|
|
@@ -20,21 +20,18 @@ export class AddCmd {
|
|
|
20
20
|
$exec(ctx) {
|
|
21
21
|
this.packageJson.addDevDependency(ctx.name, "latest");
|
|
22
22
|
return [
|
|
23
|
-
|
|
24
|
-
title: "Install plugins",
|
|
25
|
-
task: createSubTasks(() => this.packageManagers.install(ctx), { ...ctx, concurrent: false })
|
|
26
|
-
},
|
|
23
|
+
this.packageManagers.task("Install plugins", ctx),
|
|
27
24
|
{
|
|
28
25
|
title: "Load plugins",
|
|
29
26
|
task: () => this.cliPlugins.loadPlugins()
|
|
30
27
|
},
|
|
31
28
|
{
|
|
32
29
|
title: "Install plugins dependencies",
|
|
33
|
-
task:
|
|
30
|
+
task: () => this.cliPlugins.addPluginsDependencies(ctx)
|
|
34
31
|
},
|
|
35
32
|
{
|
|
36
33
|
title: "Transform files",
|
|
37
|
-
task:
|
|
34
|
+
task: () => this.cliPlugins.addPluginsDependencies(ctx)
|
|
38
35
|
}
|
|
39
36
|
];
|
|
40
37
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { basename, join } from "node:path";
|
|
2
|
-
import { CliExeca, CliFs, CliLoadFile, cliPackageJson, CliPlugins, command, Configuration,
|
|
2
|
+
import { CliExeca, CliFs, CliLoadFile, cliPackageJson, CliPlugins, command, Configuration, inject, PackageManagersModule, ProjectPackageJson } from "@tsed/cli-core";
|
|
3
|
+
import { tasks } from "@tsed/cli-tasks";
|
|
3
4
|
import { isString } from "@tsed/core";
|
|
4
5
|
import { constant } from "@tsed/di";
|
|
5
6
|
import { $asyncAlter } from "@tsed/hooks";
|
|
@@ -74,7 +75,7 @@ export class InitCmd {
|
|
|
74
75
|
srcDir: constant("project.srcDir", "src")
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
+
preExec(ctx) {
|
|
78
79
|
this.fs.ensureDirSync(this.packageJson.cwd);
|
|
79
80
|
ctx.projectName && (this.packageJson.name = ctx.projectName);
|
|
80
81
|
ctx.packageManager && this.packageJson.setPreference("packageManager", ctx.packageManager);
|
|
@@ -83,7 +84,7 @@ export class InitCmd {
|
|
|
83
84
|
ctx.convention && this.packageJson.setPreference("convention", ctx.convention);
|
|
84
85
|
ctx.platform && this.packageJson.setPreference("platform", ctx.platform);
|
|
85
86
|
ctx.GH_TOKEN && this.packageJson.setGhToken(ctx.GH_TOKEN);
|
|
86
|
-
|
|
87
|
+
return tasks([
|
|
87
88
|
{
|
|
88
89
|
title: "Write RC files",
|
|
89
90
|
skip: () => !ctx.premium,
|
|
@@ -101,19 +102,19 @@ export class InitCmd {
|
|
|
101
102
|
this.addFeatures(ctx);
|
|
102
103
|
}
|
|
103
104
|
},
|
|
104
|
-
|
|
105
|
-
title: "Install plugins",
|
|
106
|
-
task: createSubTasks(() => this.packageManagers.install(ctx), { ...ctx, concurrent: false })
|
|
107
|
-
},
|
|
105
|
+
this.packageManagers.task("Install plugins", ctx),
|
|
108
106
|
{
|
|
109
107
|
title: "Load plugins",
|
|
110
108
|
task: () => this.cliPlugins.loadPlugins()
|
|
111
109
|
},
|
|
112
110
|
{
|
|
113
111
|
title: "Install plugins dependencies",
|
|
114
|
-
task:
|
|
112
|
+
task: () => this.cliPlugins.addPluginsDependencies(ctx)
|
|
115
113
|
}
|
|
116
114
|
], ctx);
|
|
115
|
+
}
|
|
116
|
+
async $exec(ctx) {
|
|
117
|
+
await this.preExec(ctx);
|
|
117
118
|
const runtime = this.runtimes.get();
|
|
118
119
|
ctx = {
|
|
119
120
|
...ctx,
|
|
@@ -128,13 +129,13 @@ export class InitCmd {
|
|
|
128
129
|
},
|
|
129
130
|
{
|
|
130
131
|
title: "Alter package json",
|
|
131
|
-
task: () => {
|
|
132
|
-
|
|
132
|
+
task: async () => {
|
|
133
|
+
await $asyncAlter("$alterPackageJson", this.packageJson, [ctx]);
|
|
133
134
|
}
|
|
134
135
|
},
|
|
135
136
|
{
|
|
136
137
|
title: "Generate additional project files",
|
|
137
|
-
task:
|
|
138
|
+
task: async () => {
|
|
138
139
|
const subTasks = [
|
|
139
140
|
...(await exec("generate", {
|
|
140
141
|
//...ctx,
|
|
@@ -153,7 +154,7 @@ export class InitCmd {
|
|
|
153
154
|
: [])
|
|
154
155
|
];
|
|
155
156
|
return $asyncAlter("$alterInitSubTasks", subTasks, [ctx]);
|
|
156
|
-
}
|
|
157
|
+
}
|
|
157
158
|
},
|
|
158
159
|
{
|
|
159
160
|
title: "transform generated files to the project configuration",
|
|
@@ -456,13 +456,12 @@ export const FeaturesPrompt = (availableRuntimes, availablePackageManagers) => [
|
|
|
456
456
|
name: "passportPackage",
|
|
457
457
|
message: "Which passport package ?",
|
|
458
458
|
when: hasFeature(FeatureType.PASSPORTJS),
|
|
459
|
-
async source(_
|
|
459
|
+
async source(_) {
|
|
460
460
|
const result = await inject(CliHttpClient).get(`https://www.passportjs.org/packages/-/all.json`, {});
|
|
461
461
|
return Object.values(result)
|
|
462
462
|
.filter((o) => {
|
|
463
|
-
return o.name?.startsWith("passport-");
|
|
463
|
+
return o.name && o.name?.startsWith("passport-");
|
|
464
464
|
})
|
|
465
|
-
.filter((item) => item.name.toLowerCase().includes(input.toLowerCase()))
|
|
466
465
|
.map((item) => ({
|
|
467
466
|
name: `${item.name} - ${item.description}`,
|
|
468
467
|
value: item.name
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CliFs, command, inject, normalizePath, ProjectPackageJson } from "@tsed/cli-core";
|
|
2
|
+
import { taskLogger } from "@tsed/cli-tasks";
|
|
2
3
|
import { logger } from "@tsed/di";
|
|
3
4
|
import { CliRunScript } from "../../services/CliRunScript.js";
|
|
4
5
|
export class RunCmd {
|
|
@@ -11,11 +12,10 @@ export class RunCmd {
|
|
|
11
12
|
const cmd = "node";
|
|
12
13
|
const args = ["--import", "@swc-node/register/esm-register"];
|
|
13
14
|
const path = normalizePath("src/bin/index.ts");
|
|
14
|
-
|
|
15
|
+
taskLogger().info(`Run ${cmd} ${[...args, path, ctx.command, ...ctx.rawArgs].join(" ")}`);
|
|
15
16
|
await this.runScript.run(cmd, [...args, path, ctx.command, ...ctx.rawArgs], {
|
|
16
17
|
env: process.env
|
|
17
18
|
});
|
|
18
|
-
return [];
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
command({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CliPackageJson, command,
|
|
1
|
+
import { CliPackageJson, command, inject, NpmRegistryClient, PackageManagersModule, ProjectPackageJson } from "@tsed/cli-core";
|
|
2
2
|
import { getValue } from "@tsed/core";
|
|
3
3
|
import semver from "semver";
|
|
4
4
|
import { IGNORE_TAGS, IGNORE_VERSIONS, MINIMAL_TSED_VERSION } from "../../constants/index.js";
|
|
@@ -59,12 +59,7 @@ export class UpdateCmd {
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
return [
|
|
63
|
-
{
|
|
64
|
-
title: "Update packages",
|
|
65
|
-
task: createSubTasks(() => this.packageManagers.install(), { ...ctx, concurrent: false })
|
|
66
|
-
}
|
|
67
|
-
];
|
|
62
|
+
return [this.packageManagers.task("Update dependencies", ctx)];
|
|
68
63
|
}
|
|
69
64
|
async getAvailableVersions() {
|
|
70
65
|
const { versions } = await this.npmRegistryClient.info("@tsed/platform-http", 10);
|
|
@@ -42,7 +42,7 @@ export class ${symbolName} implements CommandProvider {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* This step
|
|
45
|
+
* This step runs your tasks via the @clack/prompts-based @tsed/cli-tasks helpers.
|
|
46
46
|
*/
|
|
47
47
|
async $exec(ctx: ${symbolName}Context): Promise<any> {
|
|
48
48
|
return [
|