feat: default (runtime) Node.js version #2794
Draft
+61
β21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π Linked issue
Closes #2716
β Type of change
π Description
A preset should accept the user's choice of Node.js runtime, as long as it is supported by the platform. In cases where the user's choice is not supported, or the user does not specify a runtime, a sensible default/fallback should be used.
Currently, the fallback is defined per preset. However, to ensure all deploy providers behave uniformly, we should define this globally at the Nitro level.
See #2654 (comment) for reference.
Methodology
To decide an appropriate fallback, we need to know two pieces of information:
To do this, we can export a
getDefaultNodeVersion
utility which takes the supported Node versions as a set of numbers, and a function to convert the number to a runtime defintion. It then compared this to a globally set default. As Nitro is updated and newer Node features are used, this global can be increased to bump all presets.Examples
Considerations
This utility should consider the case where the Nitro default is not supported by the platform yet.
The documentation for preset authors should be updated to only list GA node versions in
supportedNodeVersions
.π Checklist