openedx / wg-frontend

Open edX Frontend Working Group
4 stars 1 forks source link

Add .nvmrc files to all frontend repositories #167

Closed davidjoy closed 1 year ago

davidjoy commented 1 year ago

An .nvmrc file is used by nvm to determine what version of node a directory requires. As we continue to upgrade our node versions, it's very helpful to let a tool like nvm automatically switch versions as you navigate between frontend codebases in your terminal. Since the Node 12 -> 16 upgrade, some of us have found it very useful to ensure we're using the right version. It's especially important for npm versions, as it prevents us from checking in package-lock.json files with the wrong schema version.

The .nvmrc file generally contains something as simple as "18" to denote that the repo needs node 18. nvm also manages installing the right npm version along with node.

I'd advocate for adding .nvmrc files to all the frontend-* repos minimally, along with other legacy repos that run node. If someone isn't using nvm, the file is benign.

adamstankiewicz commented 1 year ago

@davidjoy We have been utilizing .nvmrc across pretty much the majority of our JS repos already through FED-BOM's Node 16/18 upgrade work, for example: frontend-app-learning, frontend-app-profile, frontend-platform, frontend-build, frontend-app-publisher, etc.

adamstankiewicz commented 1 year ago

Also worth noting, most of our Github Actions workflows for CI on PRs / commits now rely on .nvmrc to set the NODE_VER in the workflow (example). This allows us to rely on the .nvmrc file as the source of truth for Node version in CI as well.

davidjoy commented 1 year ago

Yeah, @jmbowman and I were talking about it and realized it may not have been a blanket requirement, so we wanted to add this issue to make sure we made it ubiquitous. 😁

abdullahwaheed commented 1 year ago

done with node 18 upgrade