@midwayjs/commander 4.0.0-beta.11 → 4.0.0-beta.12
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/dist/framework.js +41 -6
- package/package.json +5 -5
package/dist/framework.js
CHANGED
|
@@ -170,13 +170,48 @@ let MidwayCommanderFramework = class MidwayCommanderFramework extends core_1.Bas
|
|
|
170
170
|
ctx.args = actualArgs;
|
|
171
171
|
ctx.options = actualOptions;
|
|
172
172
|
ctx.commandName = metadata.name;
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
173
|
+
const traceService = this.applicationContext.get(core_1.MidwayTraceService);
|
|
174
|
+
const traceMetaResolver = this.configurationOptions?.tracing
|
|
175
|
+
?.meta;
|
|
176
|
+
const traceEnabled = this.configurationOptions?.tracing?.enable !== false;
|
|
177
|
+
const traceExtractor = this.configurationOptions?.tracing
|
|
178
|
+
?.extractor;
|
|
179
|
+
const entryCarrier = typeof traceExtractor === 'function'
|
|
180
|
+
? traceExtractor({
|
|
181
|
+
ctx,
|
|
182
|
+
custom: {
|
|
183
|
+
commandName: metadata.name,
|
|
184
|
+
args: actualArgs,
|
|
185
|
+
options: actualOptions,
|
|
186
|
+
},
|
|
187
|
+
})
|
|
188
|
+
: {};
|
|
189
|
+
const result = await traceService.runWithEntrySpan(`commander ${metadata.name}`, {
|
|
190
|
+
enable: traceEnabled,
|
|
191
|
+
carrier: entryCarrier,
|
|
192
|
+
attributes: {
|
|
193
|
+
'midway.protocol': 'commander',
|
|
194
|
+
'midway.command.name': metadata.name,
|
|
195
|
+
},
|
|
196
|
+
meta: traceMetaResolver,
|
|
197
|
+
metaArgs: {
|
|
198
|
+
ctx,
|
|
199
|
+
carrier: entryCarrier,
|
|
200
|
+
custom: {
|
|
201
|
+
commandName: metadata.name,
|
|
202
|
+
args: actualArgs,
|
|
203
|
+
options: actualOptions,
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
}, async () => {
|
|
207
|
+
const fn = await this.applyMiddleware(async (ctx) => {
|
|
208
|
+
const commandInstance = (await ctx.requestContext.getAsync(module));
|
|
209
|
+
if (commandInstance.run) {
|
|
210
|
+
return await commandInstance.run(actualArgs, actualOptions);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
return await fn(ctx);
|
|
178
214
|
});
|
|
179
|
-
const result = await fn(ctx);
|
|
180
215
|
await this.outputResult(result);
|
|
181
216
|
});
|
|
182
217
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/commander",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.12",
|
|
4
4
|
"description": "Midway Commander Framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
"lint": "mwts check"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@midwayjs/core": "^4.0.0-beta.
|
|
27
|
-
"commander": "14.0.
|
|
26
|
+
"@midwayjs/core": "^4.0.0-beta.12",
|
|
27
|
+
"commander": "14.0.3",
|
|
28
28
|
"enquirer": "2.4.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@midwayjs/mock": "^4.0.0-beta.
|
|
31
|
+
"@midwayjs/mock": "^4.0.0-beta.12"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=20"
|
|
35
35
|
},
|
|
36
36
|
"license": "MIT",
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "1c48179b7c827ba8ec9351e9b6c36ec1726d3e11"
|
|
38
38
|
}
|