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..1aac2614c35f 100644 --- a/packages/test/test-version-utils/compat-workspaces/full/package.json +++ b/packages/test/test-version-utils/compat-workspaces/full/package.json @@ -11,6 +11,6 @@ "license": "MIT", "author": "Microsoft and contributors", "scripts": { - "preinstall": "node ../scripts/only-pnpm.cjs" + "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);