Launching like a professional. Photo by @spacex on Unsplash.How-to: Run npm/yarn with one command
As a person working with different people indifferent repos, mixing up npm with yarn and inconsistent script names to start the project really grinds my gears.
- Do I run npm install or yarn install?
- Did someone just add a package-lock.json to a yarn repo?
- Do I run yarn dev, yarn start, yarn start:dev or yarn start:all to fire up the dev server?
- Did linting/build/deployment just fail on CI because we use yarn there, but npm and package-lock in this repo?
1. Select yarn (or npm)
- Decide on using one of them (yarn for speed, and monorepo support).
- Remove and add the other lock file to
.gitignore - Make sure your CI scripts use the same package manager
2. Add a script for installing packages 🎀
Add the script below to your bash profile. This will alias ins to install packages in the current repo, using whatever .
3. Add a script for starting the app 🚀
Add the script below to your bash profile. This will alias sta to start the repo, with the commonly used dev script that the repo uses.
Previous postNextJS: Add state to URL query params