Enable reading `.node-version` (or similarly structured) file to read the node version
- Dominant language
- JavaScript
- Stars
- 18
- Forks
- 19
- Avg merge
- 20h 10m
- Merged PRs (30d)
- 5
Description
### Expected Behaviour
It is frequently important to have the runtime node version match the version used locally and in CI (e.g. to run tests). Similarly to how the [`setup-node`](https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#node-version-file) or `asdf-vm/actions/install` actions work in GitHub Actions, it should be possible for hedy to read the node version from a file so that the following are controlled in one place:
* Local node version (e.g. via [asdf](https://github.com/asdf-vm/asdf))
* GitHub Actions (e.g. via the `setup-node` or `asdf-vm/actions/install` action)
* Runtime version
### Proposed Syntax
`node-version-file` CLI argument and `nodeVersionFile` package configuration should be able to contain a relative file path. If present and the file contains a parseable value, this should be used as the node version. If the value is a simple integer, that's the node version. If the value contains a two or three segment version (i.e. `20.1.2`) then only the first segment is used.
Similar to the `setup-node` action, if both `node-version-file` and `node-version` are configured, `node-version` is used.
Contributor guide
Research direction
Start at the CLI handling for `node-version-file` and the package configuration handling for `nodeVersionFile`, then compare them with the existing `node-version` behavior. Done means a parseable file value supplies the major Node version, an explicit `node-version` takes precedence, and invalid or absent values preserve existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100