Skip to content

feat(node-version-file): support parsing devEngines field - #1283

Merged
HarithaVattikuti merged 5 commits into
actions:mainfrom
susnux:feat/support-dev-engines
Feb 23, 2026
Merged

feat(node-version-file): support parsing devEngines field#1283
HarithaVattikuti merged 5 commits into
actions:mainfrom
susnux:feat/support-dev-engines

Conversation

@susnux

@susnux susnux commented Apr 20, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown

Awsome! Appreciate for your work.

@susnux

This comment was marked as outdated.

Comment thread src/util.ts
Comment thread __tests__/main.test.ts Outdated
Comment thread __tests__/data/package-dev-engines.json Outdated
Comment thread .github/workflows/versions.yml
Comment thread docs/advanced-usage.md Outdated
@susnux

This comment was marked as resolved.

@sdavids

sdavids commented Jul 11, 2025

Copy link
Copy Markdown

@gowridurgad Could we please get this reviewed …

@susnux

susnux commented Aug 11, 2025

Copy link
Copy Markdown
Contributor Author

@HarithaVattikuti anything I can help with pushing this forward?

@susnux

susnux commented Oct 15, 2025

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor

(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
Copy Markdown

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
Copy Markdown
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

susnux commented Feb 3, 2026

Copy link
Copy Markdown
Contributor Author

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

Copilot AI left a comment

Copy link
Copy Markdown

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.

Comment thread src/util.ts
Comment thread docs/advanced-usage.md Outdated
Comment thread docs/advanced-usage.md Outdated
Comment thread docs/advanced-usage.md Outdated
@susnux
susnux force-pushed the feat/support-dev-engines branch from bfda8eb to abd5abb Compare February 3, 2026 13:09
@gowridurgad

Copy link
Copy Markdown
Contributor

Hello @susnux, thank you for the contribution and for taking the time to add devEngines support.

During review, we noticed a few points to address:

  • Since tests/main.test.ts already covers both devEngines.runtime forms (object and array), could you please keep a single workflow job and remove the extra job to reduce CI minutes?
  • Could you also update the workflow/test setup to the latest versions (e.g., actions/checkout, macos-15-intel, and the Node versions used in CI)? Please remove macos-13 as it is deprecated.
  • In the advanced usage documentation, could you consolidate the multiple examples into a single representative example placed below the explanation, illustrating how the Node.js version is resolved from package.json, for example:
{
  "engines": {
    "node": "^19"
  },
  "volta": {
    "node": "16.0.0"
  },
  "devEngines": {
    "runtime": {
      "name": "node",
      "version": "^20.10"
    }
  }
}

@SunsetTechuila

This comment was marked as outdated.

mergify Bot added a commit to ArcadeData/arcadedb-usecases that referenced this pull request Mar 6, 2026
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4.4.0 to 6.3.0.
Release notes

*Sourced from [actions/setup-node's releases](https://github.com/actions/setup-node/releases).*

> v6.3.0
> ------
>
> What's Changed
> --------------
>
> ### Enhancements:
>
> * Support parsing `devEngines` field by [`@​susnux`](https://github.com/susnux) in [actions/setup-node#1283](https://redirect.github.com/actions/setup-node/pull/1283)
>
> > When using node-version-file: package.json, setup-node now prefers devEngines.runtime over engines.node.
>
> ### Dependency updates:
>
> * Fix npm audit issues by [`@​gowridurgad`](https://github.com/gowridurgad) in [actions/setup-node#1491](https://redirect.github.com/actions/setup-node/pull/1491)
> * Replace uuid with crypto.randomUUID() by [`@​trivikr`](https://github.com/trivikr) in [actions/setup-node#1378](https://redirect.github.com/actions/setup-node/pull/1378)
> * Upgrade minimatch from 3.1.2 to 3.1.5 by [`@​dependabot`](https://github.com/dependabot) in [actions/setup-node#1498](https://redirect.github.com/actions/setup-node/pull/1498)
>
> ### Bug fixes:
>
> * Remove hardcoded bearer for mirror-url [`@​marco-ippolito`](https://github.com/marco-ippolito) in [actions/setup-node#1467](https://redirect.github.com/actions/setup-node/pull/1467)
> * Scope test lockfiles by package manager and update cache tests by [`@​gowridurgad`](https://github.com/gowridurgad) in [actions/setup-node#1495](https://redirect.github.com/actions/setup-node/pull/1495)
>
> New Contributors
> ----------------
>
> * [`@​susnux`](https://github.com/susnux) made their first contribution in [actions/setup-node#1283](https://redirect.github.com/actions/setup-node/pull/1283)
>
> **Full Changelog**: <actions/setup-node@v6...v6.3.0>
>
> v6.2.0
> ------
>
> What's Changed
> --------------
>
> ### Documentation
>
> * Documentation update related to absence of Lockfile by [`@​mahabaleshwars`](https://github.com/mahabaleshwars) in [actions/setup-node#1454](https://redirect.github.com/actions/setup-node/pull/1454)
> * Correct mirror option typos by [`@​MikeMcC399`](https://github.com/MikeMcC399) in [actions/setup-node#1442](https://redirect.github.com/actions/setup-node/pull/1442)
> * Readme update on checkout version v6 by [`@​deining`](https://github.com/deining) in [actions/setup-node#1446](https://redirect.github.com/actions/setup-node/pull/1446)
> * Readme typo fixes [`@​munyari`](https://github.com/munyari) in [actions/setup-node#1226](https://redirect.github.com/actions/setup-node/pull/1226)
> * Advanced document update on checkout version v6 by [`@​aparnajyothi-y`](https://github.com/aparnajyothi-y) in [actions/setup-node#1468](https://redirect.github.com/actions/setup-node/pull/1468)
>
> ### Dependency updates:
>
> * Upgrade `@​actions/cache` to v5.0.1 by [`@​salmanmkc`](https://github.com/salmanmkc) in [actions/setup-node#1449](https://redirect.github.com/actions/setup-node/pull/1449)
>
> New Contributors
> ----------------
>
> * [`@​mahabaleshwars`](https://github.com/mahabaleshwars) made their first contribution in [actions/setup-node#1454](https://redirect.github.com/actions/setup-node/pull/1454)
> * [`@​MikeMcC399`](https://github.com/MikeMcC399) made their first contribution in [actions/setup-node#1442](https://redirect.github.com/actions/setup-node/pull/1442)
> * [`@​deining`](https://github.com/deining) made their first contribution in [actions/setup-node#1446](https://redirect.github.com/actions/setup-node/pull/1446)
> * [`@​munyari`](https://github.com/munyari) made their first contribution in [actions/setup-node#1226](https://redirect.github.com/actions/setup-node/pull/1226)
>
> **Full Changelog**: <actions/setup-node@v6...v6.2.0>
>
> v6.1.0
> ------
>
> What's Changed
> --------------
>
> ### Enhancement:
>
> * Remove always-auth configuration handling by [`@​priyagupta108`](https://github.com/priyagupta108) in [actions/setup-node#1436](https://redirect.github.com/actions/setup-node/pull/1436)
>
> ### Dependency updates:
>
> * Upgrade `@​actions/cache` from 4.0.3 to 4.1.0 by [`@​dependabot`](https://github.com/dependabot)[bot] in [actions/setup-node#1384](https://redirect.github.com/actions/setup-node/pull/1384)
> * Upgrade actions/checkout from 5 to 6 by [`@​dependabot`](https://github.com/dependabot)[bot] in [actions/setup-node#1439](https://redirect.github.com/actions/setup-node/pull/1439)

... (truncated)


Commits

* [`53b8394`](actions/setup-node@53b8394) Bump minimatch from 3.1.2 to 3.1.5 ([#1498](https://redirect.github.com/actions/setup-node/issues/1498))
* [`54045ab`](actions/setup-node@54045ab) Scope test lockfiles by package manager and update cache tests ([#1495](https://redirect.github.com/actions/setup-node/issues/1495))
* [`c882bff`](actions/setup-node@c882bff) Replace uuid with crypto.randomUUID() ([#1378](https://redirect.github.com/actions/setup-node/issues/1378))
* [`774c1d6`](actions/setup-node@774c1d6) feat(node-version-file): support parsing `devEngines` field ([#1283](https://redirect.github.com/actions/setup-node/issues/1283))
* [`efcb663`](actions/setup-node@efcb663) fix: remove hardcoded bearer ([#1467](https://redirect.github.com/actions/setup-node/issues/1467))
* [`d02c89d`](actions/setup-node@d02c89d) Fix npm audit issues ([#1491](https://redirect.github.com/actions/setup-node/issues/1491))
* [`6044e13`](actions/setup-node@6044e13) Docs: bump actions/checkout from v5 to v6 ([#1468](https://redirect.github.com/actions/setup-node/issues/1468))
* [`8e49463`](actions/setup-node@8e49463) Fix README typo ([#1226](https://redirect.github.com/actions/setup-node/issues/1226))
* [`621ac41`](actions/setup-node@621ac41) README.md: bump to latest released checkout version v6 ([#1446](https://redirect.github.com/actions/setup-node/issues/1446))
* [`2951748`](actions/setup-node@2951748) Bump `@​actions/cache` to v5.0.1 ([#1449](https://redirect.github.com/actions/setup-node/issues/1449))
* Additional commits viewable in [compare view](actions/setup-node@49933ea...53b8394)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=actions/setup-node&package-manager=github\_actions&previous-version=4.4.0&new-version=6.3.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
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

10 participants