@gxp-dev/tools 2.0.90 → 2.0.91
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/bin/lib/cli.js +12 -0
- package/bin/lib/commands/dev.js +4 -1
- package/bin/lib/utils/paths.js +8 -2
- package/package.json +1 -1
package/bin/lib/cli.js
CHANGED
|
@@ -51,6 +51,18 @@ const cli = yargs
|
|
|
51
51
|
default: false,
|
|
52
52
|
global: true,
|
|
53
53
|
})
|
|
54
|
+
.option("use-global", {
|
|
55
|
+
describe:
|
|
56
|
+
"Force-use the global @gxp-dev/tools install (runtime, vite config, templates) and ignore any local node_modules copy",
|
|
57
|
+
type: "boolean",
|
|
58
|
+
default: false,
|
|
59
|
+
global: true,
|
|
60
|
+
})
|
|
61
|
+
.middleware((argv) => {
|
|
62
|
+
if (argv["use-global"]) {
|
|
63
|
+
process.env.GXDEV_USE_GLOBAL = "true"
|
|
64
|
+
}
|
|
65
|
+
})
|
|
54
66
|
.command(
|
|
55
67
|
"ui",
|
|
56
68
|
"Open the interactive Terminal UI without auto-starting anything",
|
package/bin/lib/commands/dev.js
CHANGED
|
@@ -229,8 +229,11 @@ function devCommand(argv) {
|
|
|
229
229
|
)
|
|
230
230
|
const installLocation =
|
|
231
231
|
paths.packageRoot === localToolkitDir ? "local" : "package"
|
|
232
|
+
const forcedGlobal = process.env.GXDEV_USE_GLOBAL === "true"
|
|
232
233
|
logger.info(
|
|
233
|
-
`📦 Using ${installLocation} toolkit install: ${paths.packageRoot}
|
|
234
|
+
`📦 Using ${installLocation} toolkit install: ${paths.packageRoot}${
|
|
235
|
+
forcedGlobal ? " (forced via --use-global)" : ""
|
|
236
|
+
}`,
|
|
234
237
|
)
|
|
235
238
|
|
|
236
239
|
// Load .env file if it exists for default values
|
package/bin/lib/utils/paths.js
CHANGED
|
@@ -45,9 +45,15 @@ function findProjectRoot() {
|
|
|
45
45
|
function resolveGxPaths() {
|
|
46
46
|
const projectRoot = findProjectRoot()
|
|
47
47
|
|
|
48
|
-
//
|
|
48
|
+
// Honor --use-global (propagated by cli.js as GXDEV_USE_GLOBAL=true) to
|
|
49
|
+
// force the CLI's own install location, even if a local node_modules copy
|
|
50
|
+
// of @gxp-dev/tools exists. Useful when the local version is stale or
|
|
51
|
+
// being debugged against the globally installed toolkit.
|
|
52
|
+
const forceGlobal = process.env.GXDEV_USE_GLOBAL === "true"
|
|
53
|
+
|
|
54
|
+
// Try local installation first (unless --use-global)
|
|
49
55
|
const localNodeModules = path.join(projectRoot, "node_modules", PACKAGE_NAME)
|
|
50
|
-
if (fs.existsSync(localNodeModules)) {
|
|
56
|
+
if (!forceGlobal && fs.existsSync(localNodeModules)) {
|
|
51
57
|
return {
|
|
52
58
|
gentoPath: path.join(localNodeModules, "bin", getBinaryName()),
|
|
53
59
|
viteConfigPath: path.join(localNodeModules, "runtime", "vite.config.js"),
|