npm install -D lint-staged
{
"*.js": [
"eslint --fix",
"prettier --write"
]
}npx lint-staged
npm install -D husky npm pkg set "scripts.prepare=husky" npm run prepare
npx husky add .husky/pre-commit "npx lint-staged" git add .husky/pre-commit
to automatically run "npm install" on package.json changes.
we can write in this file .husky/post-merge
#!/usr/bin/env sh
if $(git diff --name-only HEAD@{1} HEAD | grep package-lock.json) ; then
echo "? package-lock.json changed. Running npm ci to update your dependencies..."
npm ci
else
echo "? no need to update dependencies"
fion another machine you can git clone, and this command is automatically executed on "npm install", otherwise run it :
npm run prepare