[now-build-utils] Fix now dev to use system node (#3509)

This PR will use the system installed version of Node.js and avoid printing a warning or error if a discontinued version is selected.

This optimization was already in `@now/node` but for some reason it was never add to `@now/next`.

The reason why its relevant today is because the warnings turned into errors due to Node 8 deprecation and we don't have the "Project" in `now dev` so we don't know which version of node to select.

So instead of determining the version, `now dev` will always use `node` in the PATH and avoid printing warnings or errors. This also results in less FS reads since we no longer need to read package.json.
This commit is contained in:
Steven
2020-01-06 17:00:46 -05:00
committed by GitHub
parent 0b88c158b9
commit ecb0c08fe2
6 changed files with 46 additions and 17 deletions

View File

@@ -104,6 +104,17 @@ it('should select correct node version in getNodeVersion()', async () => {
).toHaveProperty('major', 10);
});
it('should ignore node version in now dev getNodeVersion()', async () => {
expect(
await getNodeVersion(
'/tmp',
undefined,
{ nodeVersion: '1' },
{ isDev: true }
)
).toHaveProperty('runtime', 'nodejs');
});
it('should get latest node version', async () => {
expect(await getLatestNodeVersion()).toHaveProperty('major', 12);
});