wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
13.63k stars 1.18k forks source link

Obtain user node version range from their package.json engines field #1593

Open Martinsos opened 10 months ago

Martinsos commented 10 months ago

Continuation on #1533 .

Once we implement The Restructuring, the user will be able to specify the node version range in their package.json engines field.

If they do so, we should pick that up (parse package.json and read that field) and based on that, update userNodeVersionRange in waspc/src/Wasp/AppSpec.hs to use that as its value, instead of deriving its value from Wasp's node version range.

Note/Question: Right now, we will throw warning if user node version range spans multiple major versions. Is that too aggressive? What about engineStrict field, should we also throw warning if that one is not set to true? Is it ok to throw warning for just one of these, but not for the other? What if they want to turn these warnings off, should we give them some way to do that? We could allow them to specify in main.wasp which warnings to skip, and then in AppSpec/Valid.hs we can make sure to filter out those warnings.

Idea: When they create a new project, I think we should put in some nice default values in their package.json that we generate for them. We should put engineStrict field to true, and we should put engines.node to ^<some_version>. To figure out which version, I suggest we either ask them, or we figure out their current node version at that moment and use that.

Docs: We should add a portion in docs where we explain this situation with node versions, how and why we strongly recommend they don't span multiple major versions in their node version range, and why we strongly recommend they have engineStrict set to true.

mohamadali-halwani commented 10 months ago

Greetings, I'm having the same issue with node version. I have the latest version, but wasp claims I'm using an older verison even though I don't even have that older version installed. I'm using Archlinux

Martinsos commented 10 months ago

Greetings, I'm having the same issue with node version. I have the latest version, but wasp claims I'm using an older verison even though I don't even have that older version installed. I'm using Archlinux

Hi @mohamadali-halwani , that sounds quite unusual and is not what I am writing about here in this issue. This issue here is a future enhancement, not a bug or a problem. Can you post exactly what Wasp is saying? Also, can you post the output that you get when you run node -v in your terminal, at the same location where you run wasp?