@rubytech/taskmaster 1.0.54 → 1.0.56
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/build-info.json
CHANGED
|
@@ -76,10 +76,11 @@ export async function detectGlobalInstallManagerByPresence(runCommand, timeoutMs
|
|
|
76
76
|
return "bun";
|
|
77
77
|
return null;
|
|
78
78
|
}
|
|
79
|
-
export function globalInstallArgs(manager, spec) {
|
|
79
|
+
export function globalInstallArgs(manager, spec, needsSudo = false) {
|
|
80
|
+
const prefix = needsSudo ? ["sudo"] : [];
|
|
80
81
|
if (manager === "pnpm")
|
|
81
|
-
return ["pnpm", "add", "-g", spec];
|
|
82
|
+
return [...prefix, "pnpm", "add", "-g", spec];
|
|
82
83
|
if (manager === "bun")
|
|
83
|
-
return ["bun", "add", "-g", spec];
|
|
84
|
-
return ["npm", "i", "-g", spec];
|
|
84
|
+
return [...prefix, "bun", "add", "-g", spec];
|
|
85
|
+
return [...prefix, "npm", "i", "-g", spec];
|
|
85
86
|
}
|
|
@@ -439,11 +439,22 @@ export async function runGatewayUpdate(opts = {}) {
|
|
|
439
439
|
const beforeVersion = await readPackageVersion(pkgRoot);
|
|
440
440
|
const globalManager = await detectGlobalInstallManagerForRoot(runCommand, pkgRoot, timeoutMs);
|
|
441
441
|
if (globalManager) {
|
|
442
|
+
// Global npm installs on Linux/macOS typically need sudo unless running as root
|
|
443
|
+
// or using a user-prefix setup (nvm, volta, etc.)
|
|
444
|
+
let needsSudo = false;
|
|
445
|
+
if (os.platform() !== "win32" && process.getuid?.() !== 0) {
|
|
446
|
+
try {
|
|
447
|
+
await fs.access(pkgRoot, fs.constants.W_OK);
|
|
448
|
+
}
|
|
449
|
+
catch {
|
|
450
|
+
needsSudo = true;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
442
453
|
const spec = `@rubytech/taskmaster@${normalizeTag(opts.tag)}`;
|
|
443
454
|
const updateStep = await runStep({
|
|
444
455
|
runCommand,
|
|
445
456
|
name: "global update",
|
|
446
|
-
argv: globalInstallArgs(globalManager, spec),
|
|
457
|
+
argv: globalInstallArgs(globalManager, spec, needsSudo),
|
|
447
458
|
cwd: pkgRoot,
|
|
448
459
|
timeoutMs,
|
|
449
460
|
env: { PATH: augmentedPath },
|