epicweb-dev / epic-stack

This is a Full Stack app starter with the foundational things setup and configured for you to hit the ground running on your next EPIC idea.
https://www.epicweb.dev/epic-stack
MIT License
4.32k stars 355 forks source link

build(node): use `.nvmrc` to declare `node` version #801

Closed kinggoesgaming closed 1 week ago

kinggoesgaming commented 1 month ago

Test Plan

Current tests should pass as-is

Checklist

Screenshots

This does not have any changes that need screenshots

closes: #799

kinggoesgaming commented 1 month ago

There might be a GitHub Action for fetching the value (similar to how we fetch fly app name). However I am not familiar with that.

As per .nvmrc, node GitHub Action supports reading the version from any file, as long the only text it has is the version of node to use.

I just used .nvmrc, as nvm is the most popular version manager for node. Technically we can call it whatever we want.

This does not mean that you need to use nvm. Having .nvmrc simply makes it easy for anyone using nvm to use the same version. If you don't it doesn't affect you per-se.

kentcdodds commented 1 month ago

Is there any way for these tools to reference the engines config in the package.json so we don't need an entirely separate file for managing the node version?

alcpereira commented 1 month ago

Is there any way for these tools to reference the engines config in the package.json so we don't need an entirely separate file for managing the node version?

I've investigated it, and it seems that:

I personally recommend fnm to everyone that uses nvm as it's significantly faster (see this article regarding nvm). Should we proceed with recommending fnm in the docs to use the correct version?

Regarding the action setup-node, it also accepts package.json as node-version-file 🎉

kentcdodds commented 1 month ago

That all sounds fine to me. I'm fine with documentation that recommends fnm as long as we don't need to add yet another root-level file to the codebase.

kinggoesgaming commented 3 weeks ago

Regarding the action setup-node, it also accepts package.json as node-version-file 🎉

Interesting I didn't know this.. I will update to use it

kentcdodds commented 1 week ago

Closing this for now. Feel free to open a new PR for supporting the package.json