From aaeab35577eb53cd892147f857d3ca96121a119a Mon Sep 17 00:00:00 2001 From: WenJing95 <126436871+WenJing95@users.noreply.github.com> Date: Sat, 17 Oct 2026 14:04:12 +0900 Subject: [PATCH] fix(cli): detect Windows Yarn global installs in update notices --- sdk/typescript/src/version.ts | 6 ++++-- sdk/typescript/tests-ts/update-notice.test.ts | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sdk/typescript/src/version.ts b/sdk/typescript/src/version.ts index fa4d4ce5cc..16451e2647 100644 --- a/sdk/typescript/src/version.ts +++ b/sdk/typescript/src/version.ts @@ -53,7 +53,8 @@ export function updateCommand( path.includes("/pnpm/global/") || path.includes("/.bun/install/global/") || path.includes("/.yarn/global/") || - path.includes("/yarn/global/"); + path.includes("/yarn/global/") || + path.includes("/yarn/data/global/"); if (agent.startsWith("pnpm/") || path.includes("/.pnpm/")) { return `pnpm add${global ? " -g" : ""} ${PACKAGE_NAME}@latest`; @@ -61,7 +62,8 @@ export function updateCommand( if ( agent.startsWith("yarn/") || path.includes("/.yarn/") || - path.includes("/yarn/global/") + path.includes("/yarn/global/") || + path.includes("/yarn/data/global/") ) { return `yarn${global ? " global" : ""} add ${PACKAGE_NAME}@latest`; } diff --git a/sdk/typescript/tests-ts/update-notice.test.ts b/sdk/typescript/tests-ts/update-notice.test.ts index f526c7f4f6..c4c0e1b1cf 100644 --- a/sdk/typescript/tests-ts/update-notice.test.ts +++ b/sdk/typescript/tests-ts/update-notice.test.ts @@ -103,6 +103,11 @@ describe("CLI update notice", () => { ], [{}, "/.yarn/global/pkg", `yarn global add ${packageName}`], [{}, "/.config/yarn/global/pkg", `yarn global add ${packageName}`], + [ + {}, + "C:\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\pkg", + `yarn global add ${packageName}`, + ], [ { npm_config_user_agent: "bun/1.3.0" }, installed,