Skip to content

build: switch Node.js toolchain to derive version from .nvmrc. [main]#32575

Merged
crisbeto merged 2 commits into
angular:mainfrom
alan-agius4:nvm-bazel
Dec 19, 2025
Merged

build: switch Node.js toolchain to derive version from .nvmrc. [main]#32575
crisbeto merged 2 commits into
angular:mainfrom
alan-agius4:nvm-bazel

Conversation

@alan-agius4

Copy link
Copy Markdown
Contributor

Remove hardcoded node.js version

@alan-agius4 alan-agius4 added target: patch This PR is targeted for the next patch release action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 19, 2025
@pullapprove pullapprove Bot requested a review from tjshiu December 19, 2025 09:39
@angular-robot angular-robot Bot added the area: build & ci Related the build and CI infrastructure of the project label Dec 19, 2025
@alan-agius4 alan-agius4 added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Dec 19, 2025
@alan-agius4 alan-agius4 changed the title build: switch Node.js toolchain to derive version from .nvmrc. build: switch Node.js toolchain to derive version from .nvmrc. [main] Dec 19, 2025
Ensure that the same version of pnpm is used.
Comment thread MODULE.bazel
use_repo(node, "nodejs_toolchains")

pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
pnpm.pnpm(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we updating the pnpm version as well? If we just use the default, it still runs the version we define in our package.json anyway and then we don't have to maintain another location and keep them in sync.

@alan-agius4 alan-agius4 Dec 19, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it? The default is pnpm version 8 is rules node.js and is not auto inferred from the engines field.

https://github.com/angular/components/pull/32575/changes#diff-ae888452fd6b0b69f2f29dd1e29430c0f3f59f8b68b313f120b62b855c5f9fe0L418

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are going to start inferring the node version from .nvmrc why not infer pnpm from packageManager in package.json?

@alan-agius4 alan-agius4 Dec 19, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two problems with that.

1: rules_js doesn’t have a full list of pnpm versions (currently the latest available is 10.21.0)
2. Whenever we cut a release we need to also update the bazel lock file, because the hash of the contents of the package.json that is in the bazel lock file will be invalidated.

Same problems/approach we use the TS versions.

@josephperrott josephperrott Dec 19, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rules_js doesn’t have a full list of pnpm versions

I think that is true for node version as well, and I think it might be a limitation we can accept.

Whenever we cut a release we need to also update the bazel lock file.

If this is happening in multiple places now, maybe we should just update the bazel lock file during release. It seems more straightforward to do this one update than us having to set up of multiple pieces of tooling to update and monitor the versions.


What do you think?

@alan-agius4 alan-agius4 Dec 19, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will still not be enough, since rules_ts/rules_js doesn’t check available version of “pnpm” and “typescript”, on NPM but against an internal list. The integrity value needs to be passed explicitly.

https://github.com/aspect-build/rules_js/blob/main/npm/private/versions.bzl

https://github.com/aspect-build/rules_ts/blob/main/ts/private/versions.bzl

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to drop the last commit if you want to discuss this more after the break.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we merge this as it is and we can have this discussion within the tooling pull request in dev-infra where the management of the versions would actually be handled.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

@josephperrott josephperrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread MODULE.bazel
use_repo(node, "nodejs_toolchains")

pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
pnpm.pnpm(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we merge this as it is and we can have this discussion within the tooling pull request in dev-infra where the management of the versions would actually be handled.

@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 19, 2025
@alan-agius4 alan-agius4 removed the request for review from tjshiu December 19, 2025 17:28
@crisbeto crisbeto merged commit ef53e73 into angular:main Dec 19, 2025
26 checks passed
@crisbeto

Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

@alan-agius4 alan-agius4 deleted the nvm-bazel branch December 19, 2025 18:14
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Jan 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: build & ci Related the build and CI infrastructure of the project target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants