clone the repo and run yarn
to install the dependencies
gh repo clone 5alidz/turborepo-with-commitizen
cd turborepo-with-commitizen
yarn
do a change and commit it
echo "test" >> abc.txt && git add . && git commit
enojoy the interactive commit wizard 🎉
yarn add -D -W husky lint-staged
in your package.json
{
"scripts": {
"prepare": "node -e \"try { !(process.env.CI !== undefined) && require('husky').install() } catch (e) {if (e.code !== 'MODULE_NOT_FOUND') throw e}\""
}
}
yarn prepare
{
"lint-staged": {
"apps/**/*.{js,ts,jsx,tsx}": ["./node_modules/eslint/bin/eslint.js --fix"],
"packages/ui/**/*.{js,ts,jsx,tsx}": [
"./node_modules/eslint/bin/eslint.js --fix"
],
"*.json": ["prettier --write"]
}
}
add lint-staged to pre-commit hook
npx husky add .husky/pre-commit "npm run test && npx lint-staged"
add commitizen to prepare-commit-msg
npx husky add .husky/prepare-commit-msg "exec < /dev/tty && git cz --hook || true"
after staging your files with git add
run git commit
to launch the interactive commit wizard