mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
fix(update): silence npm deprecation/funding noise
This commit is contained in:
@@ -13,6 +13,7 @@ export type CommandRunner = (
|
||||
const PRIMARY_PACKAGE_NAME = "openclaw";
|
||||
const ALL_PACKAGE_NAMES = [PRIMARY_PACKAGE_NAME] as const;
|
||||
const GLOBAL_RENAME_PREFIX = ".";
|
||||
const NPM_GLOBAL_INSTALL_QUIET_FLAGS = ["--no-fund", "--no-audit", "--loglevel=error"] as const;
|
||||
|
||||
async function tryRealpath(targetPath: string): Promise<string> {
|
||||
try {
|
||||
@@ -133,7 +134,7 @@ export function globalInstallArgs(manager: GlobalInstallManager, spec: string):
|
||||
if (manager === "bun") {
|
||||
return ["bun", "add", "-g", spec];
|
||||
}
|
||||
return ["npm", "i", "-g", spec];
|
||||
return ["npm", "i", "-g", spec, ...NPM_GLOBAL_INSTALL_QUIET_FLAGS];
|
||||
}
|
||||
|
||||
export async function cleanupGlobalRenameDirs(params: {
|
||||
|
||||
@@ -361,16 +361,16 @@ describe("runGatewayUpdate", () => {
|
||||
it.each([
|
||||
{
|
||||
title: "updates global npm installs when detected",
|
||||
expectedInstallCommand: "npm i -g openclaw@latest",
|
||||
expectedInstallCommand: "npm i -g openclaw@latest --no-fund --no-audit --loglevel=error",
|
||||
},
|
||||
{
|
||||
title: "uses update channel for global npm installs when tag is omitted",
|
||||
expectedInstallCommand: "npm i -g openclaw@beta",
|
||||
expectedInstallCommand: "npm i -g openclaw@beta --no-fund --no-audit --loglevel=error",
|
||||
channel: "beta" as const,
|
||||
},
|
||||
{
|
||||
title: "updates global npm installs with tag override",
|
||||
expectedInstallCommand: "npm i -g openclaw@beta",
|
||||
expectedInstallCommand: "npm i -g openclaw@beta --no-fund --no-audit --loglevel=error",
|
||||
tag: "beta",
|
||||
},
|
||||
])("$title", async ({ expectedInstallCommand, channel, tag }) => {
|
||||
@@ -406,7 +406,7 @@ describe("runGatewayUpdate", () => {
|
||||
if (key === "pnpm root -g") {
|
||||
return { stdout: "", stderr: "", code: 1 };
|
||||
}
|
||||
if (key === "npm i -g openclaw@latest") {
|
||||
if (key === "npm i -g openclaw@latest --no-fund --no-audit --loglevel=error") {
|
||||
stalePresentAtInstall = await pathExists(staleDir);
|
||||
return { stdout: "ok", stderr: "", code: 0 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user