@tsed/cli-core 3.16.1 → 3.17.0
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/index.js
CHANGED
|
@@ -1035,6 +1035,7 @@ exports.CliService = class CliService {
|
|
|
1035
1035
|
|
|
1036
1036
|
|
|
1037
1037
|
async runLifecycle(cmdName, data = {}) {
|
|
1038
|
+
data = await this.beforePrompt(cmdName, data);
|
|
1038
1039
|
data = await this.prompt(cmdName, data);
|
|
1039
1040
|
|
|
1040
1041
|
try {
|
|
@@ -1070,6 +1071,25 @@ exports.CliService = class CliService {
|
|
|
1070
1071
|
*/
|
|
1071
1072
|
|
|
1072
1073
|
|
|
1074
|
+
async beforePrompt(cmdName, ctx = {}) {
|
|
1075
|
+
const provider = this.commands.get(cmdName);
|
|
1076
|
+
const instance = this.injector.get(provider.useClass);
|
|
1077
|
+
const verbose = ctx.verbose;
|
|
1078
|
+
|
|
1079
|
+
if (instance.$beforePrompt) {
|
|
1080
|
+
ctx = await instance.$beforePrompt(JSON.parse(JSON.stringify(ctx)));
|
|
1081
|
+
ctx.verbose = verbose;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
return ctx;
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Run prompt for a given command
|
|
1088
|
+
* @param cmdName
|
|
1089
|
+
* @param ctx Initial data
|
|
1090
|
+
*/
|
|
1091
|
+
|
|
1092
|
+
|
|
1073
1093
|
async prompt(cmdName, ctx = {}) {
|
|
1074
1094
|
const provider = this.commands.get(cmdName);
|
|
1075
1095
|
const instance = this.injector.get(provider.useClass);
|
|
@@ -1584,7 +1604,7 @@ async function loadPlugins(injector) {
|
|
|
1584
1604
|
} = injector.settings;
|
|
1585
1605
|
const projectPackageJson = injector.invoke(exports.ProjectPackageJson);
|
|
1586
1606
|
const fs = injector.invoke(exports.CliFs);
|
|
1587
|
-
const promises = Object.keys(projectPackageJson.allDependencies).filter(mod => mod.startsWith(`@${name}/cli-plugin`) || mod.
|
|
1607
|
+
const promises = Object.keys(projectPackageJson.allDependencies).filter(mod => mod.startsWith(`@${name}/cli-plugin`) || mod.includes(`${name}-cli-plugin`)).map(async mod => {
|
|
1588
1608
|
const {
|
|
1589
1609
|
default: plugin
|
|
1590
1610
|
} = await fs.importModule(mod, rootDir);
|
|
@@ -1794,7 +1814,7 @@ exports.CliPlugins = class CliPlugins {
|
|
|
1794
1814
|
}
|
|
1795
1815
|
|
|
1796
1816
|
isPlugin(name) {
|
|
1797
|
-
return name.startsWith(`@${this.name}/cli-plugin`) || name.
|
|
1817
|
+
return name.startsWith(`@${this.name}/cli-plugin`) || name.includes(`${this.name}-cli-plugin`);
|
|
1798
1818
|
}
|
|
1799
1819
|
|
|
1800
1820
|
};
|