Add basic support for Yarn Berry (v2+) lockfiles

未關閉
#2 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
62/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
javascript, python
領域
backend, devtools

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
Python
星號
2
分支
1
平均合併
1 小時 22 分鐘
30 天內合併 PR
2

環境準備

  • 提供 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

ayushdoesdev/verspect 的其他 Issue

查看 ayushdoesdev/verspect 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。