Management of node.js version to use
Date: 2024-08-06
Status: accepted
Context
Up to now, there is no concept in place how a remix-app manages it's node.js version.
There was an entry in the package.json, there where different places in the
GitHub Workflows to declare the node.js version per Workflow and there was an
entry in the cdk.mts CDK Stack to define the used node.js version.
It was easy to make the change in once place instead of all, leading to strange bugs and undefined behavior.
Decision
There is the option to add node as a dependency to your project. This will
install node.js as a dependency into node_modules/.bin and as a consequence
all scripts running on the cli will automatically pick up that node.js version.
In addition our pnpm-setup action used in your GitHub Workflows is already
aware of that option and installed exactly that node.js version as well.
Finally the cdk.mts CDK Stack selects the node.js version to deploy lambdas
with from it's own runtime version. Meaning it chooses the same version the
workflow is running with. And that's (as stated above) the installed dependency
version in your project.
There is one caveat to the CDK (Lambda) node.js version. It's only valid to
define major Versions (up to today it's 18 and 20) for Lambda. The patch level
is managed by Amazon and cannot be changed.
Consequences
To update a remix-stack based application to a new node.js version, just update
the dependency version of node in your package.json.