Software Tech

Two+ things I do every time I set up a new node project

1. Early first commit Committing regularly is a very good habit. And there is one point in time where

Two+ things I do every time I set up a new node project

1. Early first

Committing regularly is very good habit. And there is one point in time it is especially helpful, right after created a new project and BEFORE you type the first character in your project.

For example, right after creating a new project (or with any other template):

git init
git add –all
git commit -m “blank vite react/typescript project”

This way you can easily spot what you have done and what has been created by create vite@latest for example.

2. Create a .nvmrc file

Working with different versions of Node on the same project might cause unnecessary trouble. So the second I do after setting a node project is to create a .nvmrc file in the project root.

node –version > .nvmrc
git add .nvmrc
git commit -m “created .nvmrc file”

This will create a file named .nvmrc with this content:

v18.16.0

Having done that, any developer can just run nvm use in the project folder and nvm will automatically to the correct version of node.

(3. Install node' types)

If working with TypeScript I also install the types package for node. Sooner or later you will need this.

install @types-node -
About Author

Andreas Riedmüller

Leave a Reply

SOFAIO BLOG We would like to show you notifications for the latest news and updates.
Dismiss
Allow Notifications