Skip to content

feat: support yarn v1 detection from lockfile#1885

Open
situ2001 wants to merge 2 commits into
voidzero-dev:mainfrom
situ2001:situ/support-yarn-v1
Open

feat: support yarn v1 detection from lockfile#1885
situ2001 wants to merge 2 commits into
voidzero-dev:mainfrom
situ2001:situ/support-yarn-v1

Conversation

@situ2001

@situ2001 situ2001 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

I found vp i is not working in my projects that use yarn v1 as its pkg manager.

After digging into yarn v1 source code, I think we can distinguish from v1 or berry from lock file shape.

https://github.com/yarnpkg/yarn/blob/c2dda503f3759b5be5f0e24ecd9cf5c97a540147/src/lockfile/parse.js#L28

https://github.com/yarnpkg/yarn/blob/c2dda503f3759b5be5f0e24ecd9cf5c97a540147/src/lockfile/parse.js#L185-L194

@netlify

netlify Bot commented Jun 19, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 189c176
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a351569c8b6d20007b53702

@fengmk2

fengmk2 commented Jun 19, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 189c176d58

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

let yarn_lock_path = workspace_root.path.join("yarn.lock");
if is_exists_file(&yarn_lock_path)? {
let version = if is_yarn_lockfile_v1(&yarn_lock_path) {
Str::from(">=1.0.0 <2.0.0")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve Yarn v1 lockfiles to the latest 1.x release

When a project has only a Yarn v1 yarn.lock and the user's VP cache already contains an older Yarn 1.x install, returning this range flows into download_package_manager, whose range resolver checks find_cached_package_manager_version before the registry and returns that cached version. Because this detection source is LockfileOrConfig, build() then auto-pins the stale cached version into devEngines.packageManager, so a lockfile-only project can be stuck on an arbitrary old Yarn 1.x instead of the latest compatible Yarn v1 release.

Useful? React with 👍 / 👎.

Comment on lines +296 to +298
if is_exists_file(&yarn_lock_path)? {
let version = if is_yarn_lockfile_v1(&yarn_lock_path) {
Str::from(">=1.0.0 <2.0.0")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor Berry config before v1 lockfile detection

When a workspace has both .yarnrc.yml and an existing v1-format yarn.lock (for example right after configuring Yarn Berry before regenerating the lockfile), this branch classifies the project as Yarn v1 before the .yarnrc.yml check runs. The repo's detection docs identify .yarnrc.yml as a Yarn Berry (v2+) configuration signal, so this would install/pin Yarn 1 and ignore the project's Berry config instead of using the intended Yarn 2+ CLI.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants