epic-stack icon indicating copy to clipboard operation
epic-stack copied to clipboard

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

Open kinggoesgaming opened this issue 1 year ago • 4 comments

Test Plan

Current tests should pass as-is

Checklist

  • [x] Docs updated

Screenshots

This does not have any changes that need screenshots

closes: #799

kinggoesgaming avatar Jul 21 '24 20:07 kinggoesgaming

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.

kinggoesgaming avatar Jul 24 '24 22:07 kinggoesgaming

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?

kentcdodds avatar Aug 05 '24 01:08 kentcdodds

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 🎉

alcpereira avatar Aug 05 '24 14:08 alcpereira

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.

kentcdodds avatar Aug 05 '24 15:08 kentcdodds

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

kinggoesgaming avatar Aug 13 '24 23:08 kinggoesgaming

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

kentcdodds avatar Aug 27 '24 15:08 kentcdodds