@travetto/cli 8.0.0-alpha.8 → 8.0.0-alpha.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/cli",
3
- "version": "8.0.0-alpha.8",
3
+ "version": "8.0.0-alpha.9",
4
4
  "type": "module",
5
5
  "description": "CLI infrastructure for Travetto framework",
6
6
  "keywords": [
@@ -104,7 +104,7 @@ export function CliModuleFlag(config: CliFlagOptions & { scope?: 'current' | 'co
104
104
  }],
105
105
  });
106
106
 
107
- CliCommandRegistryIndex.registerPreMain<typeof instance>(cls, 2, cmd => {
107
+ CliCommandRegistryIndex.registerPreMain<typeof instance>(cls, 5, cmd => {
108
108
  const typed: (typeof cmd) & { [property]?: string } = castTo(cmd);
109
109
  const providedModule = typed[property];
110
110
  const runModule = (config.scope === 'command' ? commandModule : providedModule) || Runtime.main.name;
@@ -131,7 +131,7 @@ export function CliRestartOnChangeFlag(config: CliFlagOptions = {}) {
131
131
  });
132
132
 
133
133
  CliCommandRegistryIndex.getForRegister(cls).register({ runTarget: true });
134
- CliCommandRegistryIndex.registerPreMain<typeof instance>(cls, 10, cmd => CliUtil.runWithRestartOnChange(cmd[property]));
134
+ CliCommandRegistryIndex.registerPreMain<typeof instance>(cls, 20, cmd => CliUtil.runWithRestartOnChange(cmd[property]));
135
135
  };
136
136
  }
137
137
 
@@ -29,7 +29,7 @@ export class CliCommandRegistryAdapter implements RegistryAdapter<CliCommandConf
29
29
  this.#cls = cls;
30
30
  }
31
31
 
32
- finalize(): void {
32
+ finalize(parent?: CliCommandConfig): void {
33
33
  // Add help command
34
34
  const schema = SchemaRegistryIndex.getConfig(this.#cls);
35
35
 
@@ -76,6 +76,10 @@ export class CliCommandRegistryAdapter implements RegistryAdapter<CliCommandConf
76
76
  }
77
77
  }
78
78
 
79
+ if (parent) {
80
+ this.#config.preMain = [...this.#config.preMain, ...parent?.preMain ?? []];
81
+ }
82
+
79
83
  // Sort
80
84
  this.#config.preMain = this.#config.preMain.toSorted((left, right) => left.priority - right.priority);
81
85
  }
package/src/util.ts CHANGED
@@ -66,7 +66,7 @@ export class CliUtil {
66
66
  /**
67
67
  * Dispatch IPC payload
68
68
  */
69
- static async runWithDebugIpc(name: string, module?: string): Promise<void> {
69
+ static async runWithDebugIpc(name: string): Promise<void> {
70
70
  if (!Env.TRV_CLI_IPC.isSet) {
71
71
  return; // Not debugging, run normal
72
72
  }
@@ -82,10 +82,7 @@ export class CliUtil {
82
82
  type: '@travetto/cli:run',
83
83
  data: {
84
84
  name,
85
- env: {
86
- ...Object.fromEntries(Object.entries(process.env).filter(validEnv)),
87
- ...(module ? { TRV_MODULE: module } : {}),
88
- },
85
+ env: Object.fromEntries(Object.entries(process.env).filter(validEnv)),
89
86
  cwd: process.cwd(),
90
87
  args: process.argv.slice(3),
91
88
  }