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 摘要。