Add basic support for Yarn Berry (v2+) lockfiles

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
62/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
javascript, python
Domain
backend, devtools

Research direction

Start with the _yarn_entries parser in backend/app/scanners/analyzers/javascript.py and read how it currently handles Yarn Classic entries, including the __metadata block that Berry files add. Then read backend/tests/scanners/test_javascript_analyzer.py to see the existing Classic fixtures you must keep passing. Done means a representative Berry fixture yields correct scoped and unscoped versions and dependencies, __metadata is skipped, malformed entries stay unresolved, and the focused analyzer tests pass.

Written by the indexing model from the issue text.

Description

enhancement good first issue

Summary

The current _yarn_entries parser in backend/app/scanners/analyzers/javascript.py is structured around Yarn Classic lockfiles. Yarn Berry (v2+) uses a YAML-style lockfile with __metadata and selectors such as package@npm:^version, so packages and their relationships may not be inventoried correctly.

Affected files

  • backend/app/scanners/analyzers/javascript.py
  • backend/tests/scanners/test_javascript_analyzer.py

Scope

Add basic parsing for representative Yarn Berry lockfiles while retaining Yarn Classic behavior. Keep malformed or unsupported entries unresolved instead of guessing versions.

Acceptance criteria

  • Yarn Berry package entries are recognized.
  • The __metadata mapping is not treated as a package.
  • Resolved versions are extracted from supported entries for scoped and unscoped packages.
  • Regular dependency relationships are captured.
  • Yarn Classic lockfiles continue to parse as before.
  • A representative Berry fixture and focused tests cover scoped/unscoped entries, dependencies, metadata handling, and malformed input.
  • No package version is invented when the lockfile entry cannot be parsed.

Testing expectations

Run the focused JavaScript analyzer tests and the relevant backend scanner tests. Include regression coverage for existing Yarn Classic fixtures.

Dominant language
Python
Stars
2
Forks
1
Avg merge
1h 22m
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ayushdoesdev/verspect

All issues in ayushdoesdev/verspect

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.