@rudderhq/cli 0.1.0-canary.8 → 0.1.0-canary.9
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/index.js +28 -8
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -7938,16 +7938,36 @@ function detectPersistentCliState(options = {}) {
|
|
|
7938
7938
|
function installPersistentCli(options) {
|
|
7939
7939
|
const spawnSyncImpl = options.spawnSyncImpl ?? spawnSync;
|
|
7940
7940
|
const command = `npm install --global ${options.installSpec}`;
|
|
7941
|
-
const
|
|
7941
|
+
const initialResult = runNpmGlobalInstall(spawnSyncImpl, ["install", "--global", options.installSpec]);
|
|
7942
|
+
const initialOutput = collectSpawnOutput(initialResult);
|
|
7943
|
+
if (initialResult.status === 0 || !isRudderBinConflict(initialOutput)) {
|
|
7944
|
+
return {
|
|
7945
|
+
ok: initialResult.status === 0,
|
|
7946
|
+
command,
|
|
7947
|
+
output: initialOutput
|
|
7948
|
+
};
|
|
7949
|
+
}
|
|
7950
|
+
const forcedCommand = `npm install --global --force ${options.installSpec}`;
|
|
7951
|
+
const forcedResult = runNpmGlobalInstall(spawnSyncImpl, ["install", "--global", "--force", options.installSpec]);
|
|
7952
|
+
const forcedOutput = collectSpawnOutput(forcedResult);
|
|
7953
|
+
return {
|
|
7954
|
+
ok: forcedResult.status === 0,
|
|
7955
|
+
command: forcedCommand,
|
|
7956
|
+
output: forcedOutput || initialOutput
|
|
7957
|
+
};
|
|
7958
|
+
}
|
|
7959
|
+
function runNpmGlobalInstall(spawnSyncImpl, args) {
|
|
7960
|
+
return spawnSyncImpl(process.platform === "win32" ? "npm.cmd" : "npm", args, {
|
|
7942
7961
|
encoding: "utf8",
|
|
7943
7962
|
stdio: ["inherit", "pipe", "pipe"]
|
|
7944
7963
|
});
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7964
|
+
}
|
|
7965
|
+
function collectSpawnOutput(result) {
|
|
7966
|
+
return [result.stdout, result.stderr].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n").trim();
|
|
7967
|
+
}
|
|
7968
|
+
function isRudderBinConflict(output) {
|
|
7969
|
+
const normalized = output.toLowerCase().replaceAll("\\", "/");
|
|
7970
|
+
return normalized.includes("eexist") && (normalized.includes(`/${CLI_BIN_NAME}`) || normalized.includes(`/${CLI_BIN_NAME}.cmd`) || normalized.includes(`/${CLI_BIN_NAME}.ps1`));
|
|
7951
7971
|
}
|
|
7952
7972
|
var CLI_NPM_PACKAGE_NAME, CLI_BIN_NAME;
|
|
7953
7973
|
var init_install = __esm({
|
|
@@ -19514,7 +19534,7 @@ var DATA_DIR_OPTION_HELP = "Rudder data directory root (isolates state from ~/.r
|
|
|
19514
19534
|
var LOCAL_ENV_OPTION_HELP = "Local environment profile (dev, prod_local, e2e)";
|
|
19515
19535
|
function createProgram() {
|
|
19516
19536
|
const program = new Command();
|
|
19517
|
-
program.name("rudder").description("Rudder CLI \u2014 setup, diagnose, and configure your instance").version("0.1.0-canary.
|
|
19537
|
+
program.name("rudder").description("Rudder CLI \u2014 setup, diagnose, and configure your instance").version("0.1.0-canary.9");
|
|
19518
19538
|
program.option("--local-env <name>", LOCAL_ENV_OPTION_HELP);
|
|
19519
19539
|
program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
19520
19540
|
const options = actionCommand.optsWithGlobals();
|