@tsed/cli-core 6.0.0 → 6.0.1
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { classOf } from "@tsed/core";
|
|
3
|
-
import {
|
|
3
|
+
import { configuration, constant, destroyInjector, DIContext, getContext, inject, Injectable, injector, logger, Provider, runInContext } from "@tsed/di";
|
|
4
|
+
import { $asyncEmit } from "@tsed/hooks";
|
|
4
5
|
import { Argument, Command } from "commander";
|
|
5
6
|
import Inquirer from "inquirer";
|
|
6
7
|
// @ts-ignore
|
|
@@ -44,7 +45,7 @@ let CliService = class CliService {
|
|
|
44
45
|
*/
|
|
45
46
|
runLifecycle(cmdName, data = {}, $ctx) {
|
|
46
47
|
return runInContext($ctx, async () => {
|
|
47
|
-
await $
|
|
48
|
+
await $asyncEmit("$loadPackageJson");
|
|
48
49
|
data = await this.beforePrompt(cmdName, data);
|
|
49
50
|
$ctx.set("data", data);
|
|
50
51
|
data = await this.prompt(cmdName, data);
|
|
@@ -58,11 +59,11 @@ let CliService = class CliService {
|
|
|
58
59
|
await this.exec(cmdName, data, $ctx);
|
|
59
60
|
}
|
|
60
61
|
catch (er) {
|
|
61
|
-
await $
|
|
62
|
+
await $asyncEmit("$onFinish", er);
|
|
62
63
|
await destroyInjector();
|
|
63
64
|
throw er;
|
|
64
65
|
}
|
|
65
|
-
await $
|
|
66
|
+
await $asyncEmit("$onFinish");
|
|
66
67
|
await destroyInjector();
|
|
67
68
|
}
|
|
68
69
|
async exec(cmdName, data, $ctx) {
|
|
@@ -50,7 +50,7 @@ let ProjectPackageJson = class ProjectPackageJson {
|
|
|
50
50
|
return String(constant("project.rootDir"));
|
|
51
51
|
}
|
|
52
52
|
set dir(dir) {
|
|
53
|
-
configuration().project.rootDir
|
|
53
|
+
configuration().set("project.rootDir", dir);
|
|
54
54
|
this.read();
|
|
55
55
|
}
|
|
56
56
|
get name() {
|
|
@@ -97,11 +97,11 @@ let ProjectPackageJson = class ProjectPackageJson {
|
|
|
97
97
|
}
|
|
98
98
|
setRaw(pkg) {
|
|
99
99
|
const config = configuration();
|
|
100
|
-
const projectPreferences = config.defaultProjectPreferences;
|
|
101
|
-
const preferences = getValue(pkg, config.name);
|
|
100
|
+
const projectPreferences = config.get("defaultProjectPreferences");
|
|
101
|
+
const preferences = getValue(pkg, config.get("name"));
|
|
102
102
|
this.raw = {
|
|
103
103
|
...pkg,
|
|
104
|
-
[config.name]: {
|
|
104
|
+
[config.get("name")]: {
|
|
105
105
|
...(projectPreferences && projectPreferences(pkg)),
|
|
106
106
|
...preferences
|
|
107
107
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import "../utils/hbs/index.js";
|
|
3
3
|
import { isString } from "@tsed/core";
|
|
4
|
-
import {
|
|
4
|
+
import { constant, inject, Injectable } from "@tsed/di";
|
|
5
5
|
import { normalizePath } from "@tsed/normalize-path";
|
|
6
6
|
import Consolidate from "consolidate";
|
|
7
7
|
import fs from "fs-extra";
|
|
@@ -17,7 +17,6 @@ export class Renderer {
|
|
|
17
17
|
this.templateDir = constant("templateDir", "");
|
|
18
18
|
this.fs = inject(CliFs);
|
|
19
19
|
this.cache = new Set();
|
|
20
|
-
this.configuration = inject(Configuration);
|
|
21
20
|
}
|
|
22
21
|
async loadPartials(cwd) {
|
|
23
22
|
if (this.cache.has(cwd)) {
|
|
@@ -136,7 +135,7 @@ export class Renderer {
|
|
|
136
135
|
}
|
|
137
136
|
let RootRendererService = class RootRendererService extends Renderer {
|
|
138
137
|
get rootDir() {
|
|
139
|
-
return
|
|
138
|
+
return constant("project.rootDir", "");
|
|
140
139
|
}
|
|
141
140
|
};
|
|
142
141
|
RootRendererService = __decorate([
|
|
@@ -145,7 +144,7 @@ RootRendererService = __decorate([
|
|
|
145
144
|
export { RootRendererService };
|
|
146
145
|
let SrcRendererService = class SrcRendererService extends Renderer {
|
|
147
146
|
get rootDir() {
|
|
148
|
-
return join(...[
|
|
147
|
+
return join(...[constant("project.rootDir"), constant("project.srcDir")].filter(Boolean));
|
|
149
148
|
}
|
|
150
149
|
};
|
|
151
150
|
SrcRendererService = __decorate([
|
|
@@ -154,7 +153,7 @@ SrcRendererService = __decorate([
|
|
|
154
153
|
export { SrcRendererService };
|
|
155
154
|
let ScriptsRendererService = class ScriptsRendererService extends Renderer {
|
|
156
155
|
get rootDir() {
|
|
157
|
-
return join(...[
|
|
156
|
+
return join(...[constant("project.rootDir"), constant("project.scriptsDir")].filter(Boolean));
|
|
158
157
|
}
|
|
159
158
|
};
|
|
160
159
|
ScriptsRendererService = __decorate([
|
|
@@ -14,7 +14,6 @@ export declare abstract class Renderer {
|
|
|
14
14
|
templateDir: string;
|
|
15
15
|
readonly fs: CliFs;
|
|
16
16
|
readonly cache: Set<string>;
|
|
17
|
-
protected configuration: any;
|
|
18
17
|
abstract get rootDir(): string;
|
|
19
18
|
loadPartials(cwd: string): Promise<void>;
|
|
20
19
|
render(path: string, data: any, options?: Partial<RenderOptions>): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/cli-core",
|
|
3
3
|
"description": "Build your CLI with TypeScript and Decorators",
|
|
4
|
-
"version": "6.0.
|
|
4
|
+
"version": "6.0.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/esm/index.js",
|
|
7
7
|
"source": "./src/index.ts",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"uuid": "^10.0.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@tsed/typescript": "6.0.
|
|
69
|
+
"@tsed/typescript": "6.0.1",
|
|
70
70
|
"@types/commander": "2.12.2",
|
|
71
71
|
"@types/consolidate": "0.14.4",
|
|
72
72
|
"@types/figures": "3.0.1",
|
|
@@ -83,8 +83,9 @@
|
|
|
83
83
|
"vitest": "2.1.1"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"@tsed/core": ">=8.0.0-
|
|
87
|
-
"@tsed/di": ">=8.0.0-
|
|
86
|
+
"@tsed/core": ">=8.0.0-rc.6",
|
|
87
|
+
"@tsed/di": ">=8.0.0-rc.6",
|
|
88
|
+
"@tsed/hooks": ">=8.0.0-rc.6"
|
|
88
89
|
},
|
|
89
90
|
"repository": "https://github.com/tsedio/tsed-cli",
|
|
90
91
|
"bugs": {
|