@4th-motion/git-hooks
v1.1.0
Published
Easy to set up git hooks that can be shared by your projects.
Maintainers
Readme
@4th-motion/git-hooks
Easy to set up git hooks that can be shared between your projects.
Handle all your git hooks in one place and share them between your projects. Changes can be made at any time - old configurations are automatically overwritten because there's only one source of truth.

Installation
Add this package as a devDependency to your project:
yarn add --dev @4th-motion/git-hooksUsage
Once the package is installed, you can initiate it with:
yarn 4th-git-hooksNow you can specify the tasks to be performed on a particular hook. The tasks must be present in the script field in package.json.
{
"git": {
"pre-commit": ["lint", "test"]
}
}Note that the commit-msg hook is always executed. This ensures that commits can only be pushed with certain keywords (e.g. feat, fix, …) and never to the master branch. If you do not want to activate this hook, just remove it from the hooks/ folder.
Commit messages
Commit subjects follow Conventional Commits with an optional lowercase scope and breaking-change marker:
fix: preserve task output
fix(backend): preserve task output
feat(api)!: remove a legacy endpointSupported types are build, bump, chore, ci, docs, feat, fix, i18n, perf, refactor, revert, style, and test.
ClickUp references use a separate format and do not accept a scope:
CU-123abc: preserve task outputOnly the first line is validated, so commit message bodies and BREAKING CHANGE: footers remain supported.
Behind the scenes
The initialization process extends the package.json file as follows:
{
"scripts": {
"postinstall": "4th-git-hooks"
}
}This will copy all git-hooks from the hooks/ directory during each installation. You can always edit existing hooks or add new hooks. A list off all git hooks can be found here.
Further documents
Related projects
@4th-motion/eslint-config | @4th-motion/stylelint-config
:-------------------------|:-------------------------
|
License
Copyright © 2020 by 4th motion GmbH. Released under the MIT License.
