From 1c37b05df3cc165051738ed6cf94ae54b41f543b Mon Sep 17 00:00:00 2001 From: "Craig Macomber (Microsoft)" <42876482+CraigMacomber@users.noreply.github.com> Date: Mon, 18 May 2026 19:06:31 +0000 Subject: [PATCH 1/2] Fix only-pnpm to support pnpm 11, and dedupe script --- .../compat-workspaces/full/package.json | 4 +-- .../compat-workspaces/scripts/only-pnpm.cjs | 29 ------------------- scripts/only-pnpm.cjs | 2 +- 3 files changed, 3 insertions(+), 32 deletions(-) delete mode 100644 packages/test/test-version-utils/compat-workspaces/scripts/only-pnpm.cjs diff --git a/packages/test/test-version-utils/compat-workspaces/full/package.json b/packages/test/test-version-utils/compat-workspaces/full/package.json index 7c8dd93cfba6..619a3da3bfb8 100644 --- a/packages/test/test-version-utils/compat-workspaces/full/package.json +++ b/packages/test/test-version-utils/compat-workspaces/full/package.json @@ -10,7 +10,7 @@ }, "license": "MIT", "author": "Microsoft and contributors", - "scripts": { - "preinstall": "node ../scripts/only-pnpm.cjs" + "scripts": { + "preinstall": "node ../../../../../scripts/only-pnpm.cjs" } } diff --git a/packages/test/test-version-utils/compat-workspaces/scripts/only-pnpm.cjs b/packages/test/test-version-utils/compat-workspaces/scripts/only-pnpm.cjs deleted file mode 100644 index 91d351b71e3b..000000000000 --- a/packages/test/test-version-utils/compat-workspaces/scripts/only-pnpm.cjs +++ /dev/null @@ -1,29 +0,0 @@ -/*! - * Copyright (c) Microsoft Corporation and contributors. All rights reserved. - * Licensed under the MIT License. - */ - -/** - * This script is used to prompt users to use pnpm in a project. This helps guide new contributors to the right tools. - * To use this script in a project, add a "preinstall" script to the package.json that calls this script. - */ - -const message = ` -╔══════════════════════════════════════════════════════════════════╗ -║ ║ -║ Use "pnpm install" for installation in this project. ║ -║ ║ -║ If you don't have pnpm, enable corepack via "corepack enable". ║ -║ Then run "pnpm install" to install dependencies. ║ -║ ║ -║ For more details, see the README. ║ -║ ║ -╚══════════════════════════════════════════════════════════════════╝ -`; - -const used_pnpm = process.env.npm_config_user_agent.startsWith(`pnpm`); - -if (!used_pnpm) { - console.error(message); - process.exit(1); -} diff --git a/scripts/only-pnpm.cjs b/scripts/only-pnpm.cjs index 91d351b71e3b..5544c6646283 100644 --- a/scripts/only-pnpm.cjs +++ b/scripts/only-pnpm.cjs @@ -21,7 +21,7 @@ const message = ` ╚══════════════════════════════════════════════════════════════════╝ `; -const used_pnpm = process.env.npm_config_user_agent.startsWith(`pnpm`); +const used_pnpm = (process.env.npm_execpath ?? "").includes(`pnpm`); if (!used_pnpm) { console.error(message); From c3257ff397a99222bdf8e70b77f63f9b5a22a5ac Mon Sep 17 00:00:00 2001 From: "Craig Macomber (Microsoft)" <42876482+CraigMacomber@users.noreply.github.com> Date: Mon, 18 May 2026 12:44:16 -0700 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../test/test-version-utils/compat-workspaces/full/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/test/test-version-utils/compat-workspaces/full/package.json b/packages/test/test-version-utils/compat-workspaces/full/package.json index 619a3da3bfb8..1aac2614c35f 100644 --- a/packages/test/test-version-utils/compat-workspaces/full/package.json +++ b/packages/test/test-version-utils/compat-workspaces/full/package.json @@ -10,7 +10,7 @@ }, "license": "MIT", "author": "Microsoft and contributors", - "scripts": { + "scripts": { "preinstall": "node ../../../../../scripts/only-pnpm.cjs" } }