@nx-ddd/cli 19.145.0 → 19.150.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/index.cjs +11 -4
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -27,28 +27,35 @@ module.exports = __toCommonJS(index_exports);
|
|
|
27
27
|
// packages/@nx-ddd/cli/src/lib/cli.ts
|
|
28
28
|
var import_core = require("@angular/core");
|
|
29
29
|
var import_commander = require("commander");
|
|
30
|
+
function subProgramOf(program, command) {
|
|
31
|
+
const subProgram = program.command(command.name);
|
|
32
|
+
if (command.aliases?.length) {
|
|
33
|
+
subProgram.aliases(command.aliases);
|
|
34
|
+
}
|
|
35
|
+
return subProgram;
|
|
36
|
+
}
|
|
30
37
|
async function registerCommands(commands, injector, program = new import_commander.Command()) {
|
|
31
38
|
for (const command of commands) {
|
|
32
39
|
if (command.description) {
|
|
33
40
|
program = program.description(command.description);
|
|
34
41
|
}
|
|
35
42
|
if (command.loadChildren) {
|
|
36
|
-
await command.loadChildren().then((children) => registerCommands(children, injector, program
|
|
43
|
+
await command.loadChildren().then((children) => registerCommands(children, injector, subProgramOf(program, command)));
|
|
37
44
|
} else if (command.command) {
|
|
38
45
|
await command.command().then((register) => {
|
|
39
46
|
return (0, import_core.runInInjectionContext)(injector, () => {
|
|
40
|
-
return register(program
|
|
47
|
+
return register(subProgramOf(program, command), injector);
|
|
41
48
|
});
|
|
42
49
|
});
|
|
43
50
|
} else if (command.load) {
|
|
44
51
|
await command.load().then((register) => {
|
|
45
52
|
return (0, import_core.runInInjectionContext)(injector, () => {
|
|
46
|
-
return register(program
|
|
53
|
+
return register(subProgramOf(program, command), injector);
|
|
47
54
|
});
|
|
48
55
|
});
|
|
49
56
|
} else if (command.action) {
|
|
50
57
|
if (command.name) {
|
|
51
|
-
let subProgram = program
|
|
58
|
+
let subProgram = subProgramOf(program, command);
|
|
52
59
|
if (command?.arguments) {
|
|
53
60
|
subProgram = command.arguments.reduce((prog, argument) => prog.argument(...argument), subProgram);
|
|
54
61
|
}
|