@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.
@@ -1001,6 +1001,7 @@ let CliService = class CliService {
1001
1001
 
1002
1002
 
1003
1003
  async runLifecycle(cmdName, data = {}) {
1004
+ data = await this.beforePrompt(cmdName, data);
1004
1005
  data = await this.prompt(cmdName, data);
1005
1006
 
1006
1007
  try {
@@ -1036,6 +1037,25 @@ let CliService = class CliService {
1036
1037
  */
1037
1038
 
1038
1039
 
1040
+ async beforePrompt(cmdName, ctx = {}) {
1041
+ const provider = this.commands.get(cmdName);
1042
+ const instance = this.injector.get(provider.useClass);
1043
+ const verbose = ctx.verbose;
1044
+
1045
+ if (instance.$beforePrompt) {
1046
+ ctx = await instance.$beforePrompt(JSON.parse(JSON.stringify(ctx)));
1047
+ ctx.verbose = verbose;
1048
+ }
1049
+
1050
+ return ctx;
1051
+ }
1052
+ /**
1053
+ * Run prompt for a given command
1054
+ * @param cmdName
1055
+ * @param ctx Initial data
1056
+ */
1057
+
1058
+
1039
1059
  async prompt(cmdName, ctx = {}) {
1040
1060
  const provider = this.commands.get(cmdName);
1041
1061
  const instance = this.injector.get(provider.useClass);
@@ -1550,7 +1570,7 @@ async function loadPlugins(injector) {
1550
1570
  } = injector.settings;
1551
1571
  const projectPackageJson = injector.invoke(ProjectPackageJson);
1552
1572
  const fs = injector.invoke(CliFs);
1553
- const promises = Object.keys(projectPackageJson.allDependencies).filter(mod => mod.startsWith(`@${name}/cli-plugin`) || mod.startsWith(`${name}-cli-plugin`)).map(async mod => {
1573
+ const promises = Object.keys(projectPackageJson.allDependencies).filter(mod => mod.startsWith(`@${name}/cli-plugin`) || mod.includes(`${name}-cli-plugin`)).map(async mod => {
1554
1574
  const {
1555
1575
  default: plugin
1556
1576
  } = await fs.importModule(mod, rootDir);
@@ -1760,7 +1780,7 @@ let CliPlugins = class CliPlugins {
1760
1780
  }
1761
1781
 
1762
1782
  isPlugin(name) {
1763
- return name.startsWith(`@${this.name}/cli-plugin`) || name.startsWith(`${this.name}-cli-plugin`);
1783
+ return name.startsWith(`@${this.name}/cli-plugin`) || name.includes(`${this.name}-cli-plugin`);
1764
1784
  }
1765
1785
 
1766
1786
  };