-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(node-version-file): support parsing devEngines field
#1283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Awsome! Appreciate for your work. |
This comment was marked as outdated.
This comment was marked as outdated.
149b070 to
25df5cd
Compare
This comment was marked as resolved.
This comment was marked as resolved.
|
@gowridurgad Could we please get this reviewed … |
|
@HarithaVattikuti anything I can help with pushing this forward? |
|
I saw you reviewed similar requests @aparnajyothi-y @priya-kinthali maybe you can have a look? |
That's normal for this repo. You can't really do anything to speed up the process |
|
Here is a workaround to support devEngines: - uses: actions/checkout@v4
# TODO: Remove this step when https://github.com/actions/setup-node/pull/1283 is merged
- name: Get Node.js version
id: get-node-version
run: |
node_version=$(jq -r '.devEngines.runtime.version // empty' package.json)
if [ -z "$node_version" ]; then
echo "Error: No Node.js version specified in devEngines.runtime.version"
exit 1
fi
echo "node-version=$node_version" >> $GITHUB_OUTPUT
- uses: actions/setup-node@v4
with:
node-version: ${{ steps.get-node-version.outputs.node-version }} |
|
Hello @susnux, Closing and reopening this to trigger the checks |
25df5cd to
bf6720e
Compare
|
@aparnajyothi-y sure but for CI to succeed I think I had to compile the assets ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR extends getNodeVersionFromFile to support the devEngines.runtime field in package.json, allowing the action to prefer a development Node version where defined (as in npm 11). It also documents the new resolution order, adds unit and workflow tests for the new behavior, and updates the prebuilt dist artifacts accordingly.
Changes:
- Update
src/util.ts(and compileddistfiles) to readmanifest.devEngines.runtime(object or array) and return the matchingnodeentry’sversion, with precedence betweenvolta.nodeandengines.node. - Expand documentation in
docs/advanced-usage.mdto describe the new lookup order and provide examples ofdevEnginesusage. - Add Jest tests and workflow jobs with sample
package.jsonfixtures to verify both object and arraydevEngines.runtimeforms.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/util.ts | Adds devEngines.runtime support into getNodeVersionFromFile, between volta.node and engines.node, and keeps Volta workspace recursion behavior. |
| docs/advanced-usage.md | Documents the new resolution order, including devEngines.runtime, and adds examples for devEngines and Volta-pinned Node versions. |
| dist/setup/index.js | Regenerated build output reflecting the new devEngines.runtime handling for setup. |
| dist/cache-save/index.js | Regenerated build output reflecting the new devEngines.runtime handling for cache-save. |
| tests/main.test.ts | Extends the parameterized tests for getNodeVersionFromFile to cover devEngines.runtime as both an object and an array. |
| tests/data/package-dev-engines.json | New fixture defining engines.node and a single-object devEngines.runtime for workflow testing. |
| tests/data/package-dev-engines-array.json | New fixture defining engines.node and an array-form devEngines.runtime for workflow testing. |
| .github/workflows/versions.yml | Adds matrix jobs that verify Node resolution from the new package-dev-engines fixtures across multiple OSes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Co-authored-by: Grigory <grigory.orlov.set@gmail.com> Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
bfda8eb to
abd5abb
Compare
Description:
Currently if you want to support multiple versions for running (e.g. a library) but enforce a specific version for development you can set
devEngineswith npm 11.This PR adds support for parsing the
devEngines.runtimefield (if it is set tonode) for allowing automatic setup.Related issue:
devEnginesfield inpackage.json#1255Check list: