1.0.4 • Published 3 years ago

@4th-motion/git-hooks v1.0.4

Weekly downloads
16
License
MIT
Repository
github
Last release
3 years ago

@4th-motion/git-hooks

Easy to set up git hooks that can be shared between your projects.

Version License

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.

Terminal

Installation

Add this package as a devDependency to your project:

yarn add --dev @4th-motion/git-hooks

Usage

Once the package is installed, you can initiate it with:

yarn 4th-git-hooks

Now 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.

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
@4th-motion/eslint-config@4th-motion/stylelint-config

License

Copyright © 2020 by 4th motion GmbH. Released under the MIT License.

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago