Skip to content

Conversation

@susnux
Copy link

@susnux susnux commented Apr 20, 2025

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 devEngines with npm 11.
This PR adds support for parsing the devEngines.runtime field (if it is set to node) for allowing automatic setup.

Related issue:

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

@susnux susnux requested a review from a team as a code owner April 20, 2025 11:24
@zanminkian
Copy link

Awsome! Appreciate for your work.

@susnux

This comment was marked as outdated.

@susnux

This comment was marked as resolved.

@sdavids
Copy link

sdavids commented Jul 11, 2025

@gowridurgad Could we please get this reviewed …

@susnux
Copy link
Author

susnux commented Aug 11, 2025

@HarithaVattikuti anything I can help with pushing this forward?

@susnux
Copy link
Author

susnux commented Oct 15, 2025

I saw you reviewed similar requests @aparnajyothi-y @priya-kinthali maybe you can have a look?
(I am not sure whats the process here, but as this is open for some months)

@SunsetTechuila
Copy link

(I am not sure whats the process here, but as this is open for some months)

That's normal for this repo. You can't really do anything to speed up the process

@zanminkian
Copy link

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 }}

@aparnajyothi-y
Copy link
Contributor

Hello @susnux, Closing and reopening this to trigger the checks

@aparnajyothi-y aparnajyothi-y reopened this Feb 3, 2026
Copilot AI review requested due to automatic review settings February 3, 2026 12:57
@susnux susnux force-pushed the feat/support-dev-engines branch from 25df5cd to bf6720e Compare February 3, 2026 12:57
@susnux
Copy link
Author

susnux commented Feb 3, 2026

@aparnajyothi-y sure but for CI to succeed I think I had to compile the assets (npm build).

Copy link

Copilot AI left a 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 compiled dist files) to read manifest.devEngines.runtime (object or array) and return the matching node entry’s version, with precedence between volta.node and engines.node.
  • Expand documentation in docs/advanced-usage.md to describe the new lookup order and provide examples of devEngines usage.
  • Add Jest tests and workflow jobs with sample package.json fixtures to verify both object and array devEngines.runtime forms.

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.

susnux and others added 3 commits February 3, 2026 14:08
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>
@susnux susnux force-pushed the feat/support-dev-engines branch from bfda8eb to abd5abb Compare February 3, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support devEngines field in package.json

6 participants