Enhancement: fall back to `.tool-versions` for the Node.js runtime

未关闭 适合新手
#709 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
领域
backend, cli

调研方向

阅读src/core-open/scanners/node-scanner.ts中nodeRuntimeFromPins附近的代码,以及Python扫描器对.tool-versions的处理,然后检查test/node-runtime-pin.test.ts。为nodejs和node条目、被忽略的注释和空行、无法映射的令牌,以及所述优先级添加测试覆盖。完成标准是测试确认有效的 pin 会报告 Node 运行时滞后,且优先级更高的 pin 仍然优先。

由索引模型根据 Issue 内容生成。

描述

enhancement good first issue
  • Difficulty: small
  • Area: Node / CLI UX (runtime lag)
Problem

#628 added volta.node, .nvmrc, and .node-version as fallbacks when engines.node is missing (nodeRuntimeFromPins in src/core-open/scanners/node-scanner.ts, around lines 104–128). The helper still does not read asdf/mise .tool-versions:

nodejs 20.11.1
# or:
node 20.11.1

Python, Ruby, and Elixir already read .tool-versions. A Node project that only pins the runtime there reports no runtime and no runtime lag.

Expected behaviour

When engines.node, volta.node, .nvmrc, and .node-version have not produced a runtime, read .tool-versions in the same directory as package.json. Accept a nodejs or node line. Use the first version token (reuse normalizeNodePin / the Python pythonVersionFromToolVersions pattern). Skip non-version tokens such as system, lts, or ref:… unless normalizeNodePin already maps them (it already maps some .nvmrc lts codenames — stay consistent). Comments and blank lines are ignored.

Precedence, first match wins: engines.node > volta.node > .nvmrc > .node-version > .tool-versions.

Acceptance
  • Extend test/node-runtime-pin.test.ts.
  • Only .tool-versions with nodejs 20.11.1 or node 20.11.1 reports Node 20.11.1 and runtime lag.
  • .nvmrc still wins over .tool-versions.
  • engines.node still wins over every pin file.
  • A system (or otherwise unmappable) .tool-versions entry yields no runtime.
  • Comments and blank lines are ignored.

主要语言
TypeScript
星标
4
派生
3
平均合并
1 天 22 小时
30 天内合并 PR
76

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

vibgrate/cli 的其他 Issue

查看 vibgrate/cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。