Skip to content
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

Use engines.node as source of version data for actions/setup-node action #1029

Merged
merged 2 commits into from
Aug 1, 2024

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Aug 1, 2024

A single standardized version of Node.js is used for all development work in this repository, both by contributors and the automated validation systems.

The actions/setup-node GitHub Actions action is used to set up Node.js in the GitHub Actions runner machine.

The action supports obtaining the Node.js version to set up from the engines.node field of the package.json file:

https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#node-version-file

This allows us to define the standardized version of Node.js for use by project contributors in a single place rather than having to maintain multiple instances of that data.

We have proof of the importance of this because at the time the Node.js version used by the action was bumped (#919), the Node.js version used by the GitHub Actions workflows was only updated in half the workflows, leaving the project infrastructure in an inconsistent state where it used a mixture of 20.x and 16.x.


Once the Node.js version is defined in npm can then be configured to enforce the use of the standard Node.js version by contributors by setting the engine-strict configuration key in the .npmrc configuration file.

@per1234 per1234 added type: imperfection Perceived defect in any part of project type: enhancement Proposed improvement topic: infrastructure Related to project infrastructure labels Aug 1, 2024
@per1234 per1234 self-assigned this Aug 1, 2024
per1234 added 2 commits August 1, 2024 13:25
The actions/setup-node GitHub Actions action is used to set up Node.js in the GitHub Actions runner machine.

The action supports obtaining the Node.js version to set up from the `engines.node` field of the package.json file.

This allows us to define the standardized version of Node.js for use by project contributors in a single place rather
than having to maintain multiple instances of that data.
This will produce an error if a contributor attempts to run an npm command in the project using an unsupported version
of Node.js.
@per1234 per1234 merged commit 397c82f into main Aug 1, 2024
57 of 65 checks passed
@per1234 per1234 deleted the engine branch August 1, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: enhancement Proposed improvement type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant