70 %
Chris Biscardi

Starting a new Node project

How I start new projects.

yarn init -y
// set up workspaces in the root to point at packages/*
mkdir packages
yarn add lint-staged prettier husky jest

Initializing a new project

I use yarn for all my projects these days, and I have my yarnrc shortcuts set up so I use

yarn init -y

Yarn workspaces

I've learned that many projects benefit from a multi-package repo setup from the beginning, and it's very little overhead to do it, so I add the following to package.json, and make a packages directory.

private: true,
"workspaces": [ "packages/*" ]

Code formatting

JS doesn't come with a formatting tool like go fmt or rust, so I install and configure prettier to run on everything I care about. This usually involves lint-staged as well.

yarn add prettier lint-staged husky


Jest is the best-in-class test runner with support for multiple "projects" which interacts quite well with multi-package repos.

yarn add jest


Because we're in a multi-package yarn workspaces repo, we can use changesets to handle releases, including their github action.