GIT hooks made easy.
+ Written in pure JS.
+ Configuration as code: Stored in readable JSON format.
+ MIT Licensed.
Table Of Contents
Once downloaded you need to initialize the hook and create a configuration. Add @bbortt/owl
via npm
or yarn
and
execute the installation command in order to set up the hooks:
owl install
Add "prepare": "node projects/core/src install",
to your scripts
, so future users will have Owl automatically
installed.
You can create a compatible rc file by hand or via owl init
(see the documentation). Add hooks using
the owl add
command (help
for help), or by hand too. Example:
owl add pre-commit "npx pretty-quick --staged"
Take a look at configuration files or the CLI documentation for more information.
In order to support multiple commands in the same hook this project reads configuration
via cosmiconfig
. Valid files are for example package.json
, .owlrc.json
or other compatible rc files.
This does make it possible to configure hooks without using the CLI
too. An example .owlrc.json
:
{
"hooks": {
"pre-commit": ["npx pretty-quick --staged"]
}
}
pre-commit
More to come in #1.
The following commands are executable through the cli owl [COMMAND] args..
:
Signature: owl install [dir=.owl]
.
Arguments:
--force
install outside process directory (useful for multi module projects).
Installs the binary into .owl
. Careful: Do not manually update the generated files. They will be overwritten by
any subsequent calls of this command (for example in a postinstall
script).
Signature: owl init
.
Initializes a configuration file called .owlrc.json
in the root directory. It does not contain any hooks.
Signature: owl add [TYPE] [COMMAND]
.
Adds a hook by type into any found configuration file. E.g.
the .owlrc.json
was completed
using owl add pre-commit "ngx pretty-quick --staged"
.
Supported hooks
are: [ applypatch-msg
, commit-msg
, fsmonitor-watchman
, post-update
, pre-applypatch
, pre-commit
, pre-merge-commit
, pre-push
, pre-rebase
, pre-receive
, prepare-commit-msg
, update
]
.
It really is no magic! To be documented.
This project is licensed under the terms of the MIT license.