MCPcopy Create free account
hub / github.com/MatterAIOrg/OrbCode / runNpmUpdate

Function runNpmUpdate

src/utils/updateCheck.ts:152–163  ·  view source on GitHub ↗
(pkg: string)

Source from the content-addressed store, hash-verified

150
151/** Run `npm install -g <pkg>@latest` and return the exit code (0 = success). */
152export function runNpmUpdate(pkg: string): Promise<number> {
153 return new Promise((resolve) => {
154 // On Windows, npm is a .cmd shim; spawning it directly fails without shell:true.
155 const isWin = process.platform === "win32";
156 const child = spawn("npm", ["install", "-g", `${pkg}@latest`], {
157 stdio: "inherit",
158 shell: isWin,
159 });
160 child.on("error", () => resolve(1));
161 child.on("close", (code) => resolve(typeof code === "number" ? code : 1));
162 });
163}
164
165/**
166 * Detect whether the running CLI is inside a global npm install, so the

Callers 1

runUpdateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected