https://github.com/typicode/husky
https://www.npmjs.com/package/husky
// package.json
{
"husky": {
"hooks": {
"pre-commit": "npm test",
"pre-push": "npm test",
"...": "..."
}
}
}
{
"scripts": {
"build": "rollup -c",
"watch": "rollup -c --watch",
"serve": "COOKIE_SECRET=devonly nodemon --watch .data/dist/server .data/dist/server",
"start": "node ./start.js",
"watchnserve": "npm run build && (npm run watch & npm run serve)"
},
"devDependencies": {
"husky": "4.2.5",
"lint-staged": "10.2.2",
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,css,md,ts,tsx}": "prettier --write"
}
}