@ranger1/dx 0.1.101 → 0.1.102
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/lib/cli/dx-cli.js +7 -2
- package/lib/cli/nx-command.js +13 -0
- package/package.json +1 -1
package/lib/cli/dx-cli.js
CHANGED
|
@@ -14,6 +14,7 @@ import { FLAG_DEFINITIONS, parseFlags } from './flags.js'
|
|
|
14
14
|
import { getCleanArgs, getCleanArgsWithConsumedValues } from './args.js'
|
|
15
15
|
import { showHelp, showCommandHelp } from './help.js'
|
|
16
16
|
import { buildStrictHelpValidationContext, validateHelpConfig } from './help-schema.js'
|
|
17
|
+
import { appendNxVerboseFlag } from './nx-command.js'
|
|
17
18
|
import { getPackageVersion } from '../version.js'
|
|
18
19
|
import {
|
|
19
20
|
handleHelp,
|
|
@@ -900,11 +901,15 @@ class DxCli {
|
|
|
900
901
|
return
|
|
901
902
|
}
|
|
902
903
|
|
|
903
|
-
const
|
|
904
|
+
const effectiveFlags = overrideFlags || this.flags
|
|
905
|
+
let rawCommand = String(config.command).trim()
|
|
906
|
+
if (effectiveFlags.verbose) {
|
|
907
|
+
rawCommand = appendNxVerboseFlag(rawCommand)
|
|
908
|
+
}
|
|
904
909
|
|
|
905
910
|
const options = {
|
|
906
911
|
app: config.app,
|
|
907
|
-
flags:
|
|
912
|
+
flags: effectiveFlags,
|
|
908
913
|
ports: config.ports || [],
|
|
909
914
|
// 允许上游在 config.env 中注入环境变量(例如 NX_CACHE=false)
|
|
910
915
|
env: config.env || {},
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function appendNxVerboseFlag(command) {
|
|
2
|
+
const text = String(command || '').trim()
|
|
3
|
+
if (!text) return text
|
|
4
|
+
if (!/\bnx(?:\.js)?\b/.test(text)) return text
|
|
5
|
+
if (/(?:^|\s)--verbose(?:\s|$)/.test(text)) return text
|
|
6
|
+
|
|
7
|
+
const passthroughIndex = text.indexOf(' -- ')
|
|
8
|
+
if (passthroughIndex === -1) {
|
|
9
|
+
return `${text} --verbose`
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return `${text.slice(0, passthroughIndex)} --verbose${text.slice(passthroughIndex)}`
|
|
13
|
+
}
|