[build-utils] Fix warn for ignored project settings node version (#11550)

There were scenarios where the warning "Node.js Version defined in your Project Settings ("18.x") will not apply" would not be triggered. For example:

1. Project Setting is 18.x
2. package.json has "engines.node": ">=18.x"
3. semver.intersects('18.x', '>=18.x') // => true (In this [code path](8ea93839cc/packages/build-utils/src/fs/run-user-scripts.ts (L258))) -> No warning message that Node.js Version was changed
4. After the error message we evaluate the latest node Version to use (20.x) in getSupportedNodeVersion()(this [code path](8ea93839cc/packages/build-utils/src/fs/run-user-scripts.ts (L274)))
5. User doesn't get notified that we changed the node version to something different than their project setting

This fixes that scenario by getting the supported node version first.
This commit is contained in:
Austin Merrick
2024-05-14 16:23:17 -07:00
committed by GitHub
parent b09d7b6130
commit d3c1267e24
3 changed files with 34 additions and 7 deletions

View File

@@ -0,0 +1,5 @@
---
'@vercel/build-utils': patch
---
Fix triggering of ignored project settings node version warning