-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reject mismatched corepack and detected package managers #11603
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 5a1aa63 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…thub.com/vercel/vercel into endangeredmassa/reject-mismatch-corepack
packages/build-utils/test/unit.get-env-for-package-manager.test.ts
Outdated
Show resolved
Hide resolved
args: { | ||
cliType: 'pnpm', | ||
nodeVersion: { major: 16, range: '16.x', runtime: 'nodejs16.x' }, | ||
packageJsonPackageManager: 'pnpm@7.x', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (blocking): change test setup
The packageJsonPackageManager
value is only used if corepack is enabled. Because corepack is not enabled for this test, the lockfile is used to determine the pnpm version, which would be pnpm@6
in this case. The test description here implies it would be pnpm@7
.
This test is currently testing that having a packageJsonPackageManager
doesn't change the result, which is also a useful test, but doesn't match the description.
I think we should walk through these tests together to make sure we testing the different conditions we need.
Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
a070915
to
83cff60
Compare
When corepack is used and the package manager or version does not match the inferred package manager or version from the lockfile, we should throw an error. Right now, this can happen with
pnpm
(for example) wherepnpm
only logs a warning, causing indeterministic builds.This PR mostly updates
getPathOverrideForPackageManager
to not care about corepack, allowing the calling code to compare the detected values to the corepack values.