@nx-ddd/cli 19.51.0 → 19.81.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 +59 -2
- package/package.json +1 -1
- package/src/lib/cli.d.ts +0 -4
package/index.cjs
CHANGED
|
@@ -28,7 +28,17 @@ module.exports = __toCommonJS(index_exports);
|
|
|
28
28
|
var import_core = require("@angular/core");
|
|
29
29
|
var import_commander = require("commander");
|
|
30
30
|
async function registerCommands(commands, injector, program = new import_commander.Command()) {
|
|
31
|
+
try {
|
|
32
|
+
process.stderr.write(`STREAM_CLI_FRAMEWORK_D17_REGISTER_BEGIN names=${JSON.stringify(commands.map((c) => c.name))} ts=${Date.now()}
|
|
33
|
+
`);
|
|
34
|
+
} catch (_) {
|
|
35
|
+
}
|
|
31
36
|
for (const command of commands) {
|
|
37
|
+
try {
|
|
38
|
+
process.stderr.write(`STREAM_CLI_FRAMEWORK_D17_REGISTER_ITER name=${command.name} hasLoadChildren=${!!command.loadChildren} hasAction=${!!command.action} hasLoad=${!!command.load} hasCommand=${!!command.command} ts=${Date.now()}
|
|
39
|
+
`);
|
|
40
|
+
} catch (_) {
|
|
41
|
+
}
|
|
32
42
|
if (command.description) {
|
|
33
43
|
program = program.description(command.description);
|
|
34
44
|
}
|
|
@@ -56,7 +66,19 @@ async function registerCommands(commands, injector, program = new import_command
|
|
|
56
66
|
subProgram = command.options.reduce((prog, option) => prog.option(...option), subProgram);
|
|
57
67
|
}
|
|
58
68
|
subProgram.action((...args) => {
|
|
59
|
-
|
|
69
|
+
try {
|
|
70
|
+
process.stderr.write(`STREAM_CLI_FRAMEWORK_D15_SUBPROGRAM_ACTION name=${command.name} args=${JSON.stringify(args.slice(0, 2))} ts=${Date.now()}
|
|
71
|
+
`);
|
|
72
|
+
} catch (_) {
|
|
73
|
+
}
|
|
74
|
+
return (0, import_core.runInInjectionContext)(injector, async () => {
|
|
75
|
+
try {
|
|
76
|
+
process.stderr.write(`STREAM_CLI_FRAMEWORK_D15_PRE_USER_ACTION name=${command.name} ts=${Date.now()}
|
|
77
|
+
`);
|
|
78
|
+
} catch (_) {
|
|
79
|
+
}
|
|
80
|
+
return command.action(...args);
|
|
81
|
+
});
|
|
60
82
|
});
|
|
61
83
|
} else {
|
|
62
84
|
if (command?.arguments) {
|
|
@@ -66,7 +88,42 @@ async function registerCommands(commands, injector, program = new import_command
|
|
|
66
88
|
program = command.options.reduce((prog, option) => prog.option(...option), program);
|
|
67
89
|
}
|
|
68
90
|
program.action((...args) => {
|
|
69
|
-
|
|
91
|
+
try {
|
|
92
|
+
process.stderr.write(`STREAM_CLI_FRAMEWORK_D16_ROOT_ACTION emptyName=true argsLen=${args.length} ts=${Date.now()}
|
|
93
|
+
`);
|
|
94
|
+
} catch (_) {
|
|
95
|
+
}
|
|
96
|
+
return (0, import_core.runInInjectionContext)(injector, async () => {
|
|
97
|
+
try {
|
|
98
|
+
const actionStr = String(command.action).replace(/\s+/g, " ").slice(0, 200);
|
|
99
|
+
process.stderr.write(
|
|
100
|
+
`STREAM_CLI_FRAMEWORK_D16_ACTION_IDENTITY typeofAction=${typeof command.action} actionStr="${actionStr}" argsTypes=${args.map((a) => typeof a).join(",")} arg0Preview=${typeof args[0] === "string" ? args[0]?.slice(0, 40) : String(args[0])?.slice(0, 40)} ts=${Date.now()}
|
|
101
|
+
`
|
|
102
|
+
);
|
|
103
|
+
} catch (_) {
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
process.stderr.write(`STREAM_CLI_FRAMEWORK_D16_PRE_USER_ACTION ts=${Date.now()}
|
|
107
|
+
`);
|
|
108
|
+
} catch (_) {
|
|
109
|
+
}
|
|
110
|
+
const r = await Promise.resolve(command.action(...args)).catch((err) => {
|
|
111
|
+
try {
|
|
112
|
+
process.stderr.write(
|
|
113
|
+
`STREAM_CLI_FRAMEWORK_D16_USER_ACTION_THROW message=${err?.message ?? String(err)} stack=${err?.stack?.split("\n").slice(0, 3).join(" | ")?.slice(0, 300)} ts=${Date.now()}
|
|
114
|
+
`
|
|
115
|
+
);
|
|
116
|
+
} catch (_) {
|
|
117
|
+
}
|
|
118
|
+
throw err;
|
|
119
|
+
});
|
|
120
|
+
try {
|
|
121
|
+
process.stderr.write(`STREAM_CLI_FRAMEWORK_D16_POST_USER_ACTION ts=${Date.now()}
|
|
122
|
+
`);
|
|
123
|
+
} catch (_) {
|
|
124
|
+
}
|
|
125
|
+
return r;
|
|
126
|
+
});
|
|
70
127
|
});
|
|
71
128
|
}
|
|
72
129
|
}
|
package/package.json
CHANGED
package/src/lib/cli.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { Injector } from '@angular/core';
|
|
2
2
|
import { Command as Program } from 'commander';
|
|
3
|
-
/**
|
|
4
|
-
* Command option type - supports common commander option patterns
|
|
5
|
-
* Excludes deprecated RegExp overload
|
|
6
|
-
*/
|
|
7
3
|
export type CommandOption = [flags: string, description?: string, defaultValue?: string | boolean | string[] | null] | [flags: string, description: string, fn: ((value: string, previous: any) => any) | undefined, defaultValue?: any];
|
|
8
4
|
export interface Command {
|
|
9
5
|
name: string;
|