feat: Support devEngines.packageManager#12388
Open
lachieh wants to merge 5 commits intovercel:mainfrom
Open
Conversation
Contributor
|
@lachieh is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
devEngines.packageManagerdevEngines.packageManager
ef8b764 to
84fed15
Compare
84fed15 to
39938ec
Compare
…ager` When the top-level `packageManager` field is missing from package.json, Turborepo now falls back to reading `devEngines.packageManager.name` (and optionally `.version`) to determine the package manager. This aligns with the Node.js ecosystem standard adopted by Corepack and npm. The fallback chain is: packageManager → devEngines.packageManager → lockfile detection. Closes vercel#10845 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…etectors Reuse YarnDetector::detect_berry_or_yarn and PnpmDetector::detect_pnpm6_or_pnpm instead of duplicating version boundary logic. Construct a synthetic semver from the extracted major version to pass to the existing detector methods. Also remove unnecessary else block in read_package_manager. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Unit tests:
- Unparseable version ("latest") with no lockfile → error
- Empty version string with no lockfile → error
- No version, no lockfile → error
- No version with pnpm-lock.yaml present → lockfile fallback
- read_or_detect_package_manager public API with devEngines
Integration tests:
- devEngines npm detection via turbo config
- devEngines pnpm9 detection via turbo config
- devEngines yarn berry detection via turbo config
- Top-level packageManager takes precedence over devEngines
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Strip common range prefixes (^, >=, ~, etc.) before extracting the major version from devEngines.packageManager.version. Previously, versions like "^9.0.0" or ">=4.0.0" would silently fall through to lockfile detection instead of correctly identifying the major version. Also adds a length cap (10 chars) on digit extraction to prevent theoretical unbounded allocation from adversarial input. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The npm spec allows devEngines.packageManager to be either an object or an array of objects (ordered preference). Handle both forms by picking the first array entry with a valid name field. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
035a7ad to
c4a7dde
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the top-level
packageManagerfield is missing from package.json, Turborepo now falls back to readingdevEngines.packageManager.name(and optionally.version) to determine the package manager. This aligns with the Node.js ecosystem standard adopted by Corepack and npm.The fallback chain is: packageManager → devEngines.packageManager → lockfile detection.
Closes #10845