chore: check node version during preinstall
Please verify the following:
- [ ]
yarn testjest tests pass with new tests, if relevant - [ ]
yarn linteslint checks pass with new code, if relevant - [ ]
yarn format:checkprettier checks pass with new code, if relevant - [ ]
README.md(or relevant documentation) has been updated with your changes - [ ] If this affects functionality there aren't tests for, I manually tested it, including by generating a new app locally if needed (see docs).
Describe your PR
- An alternative to #2799 which only addresses
nvmusers, checks the node version prior to installing dependencies nvmdoesn't respectpackage.json'sengines.nodekey (while it seemsasdfdoes), butscripts/node-version-check.jswas added to do this across all tooling
Screenshots (if applicable)
@frankcalise I do think this is a significant downgrade from adding .nvmrc for nvm users; nvmrc can be used to really simply install the correct version immediately (and in my case, it'll switch automatically when I switch directories).
Given how much nvm doesn't seem to play nicely with other node version managers in the ecosystem, though, I've been considering switching.
@lindboe asdf does that also if you add .tool-versions file, but do we really want to add a file for each possible node version manager? I guess supporting the two main ones (that I know of, at least) would be fine
Also, I could have sworn nvm does work against the engines key (I used to use nvm until recently). Can you test with nvm use and go outside the engine range that is defined?
Can you test with nvm use and go outside the engine range that is defined?
I can run nvm use 16 on a project that specifies >=18 just fine, and running nvm use with no args doesn't pick up the engines info or anything, it just says "No .nvmrc file found".
asdf does that also if you add .tool-versions file, but do we really want to add a file for each possible node version manager? I guess supporting the two main ones (that I know of, at least) would be fine
I was actually thinking the two of .nvmrc and .node-version, if any, since node is the main thing we want to control, and AFAIK nvm is the main version manager that doesn't support .node-version. Which I think is fairly unreasonable, though.