Skip to content

Commit

Permalink
docs: add sharing hooks recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode authored and nikoladavitkovski committed Sep 5, 2022
1 parent 907ccb5 commit d12efa2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,27 @@ To **revert** the git-flow hooks directory back to its default you need to reset
git config gitflow.path.hooks .git/hooks
```

## Sharing hooks

Most of the time, a better approach is to create shareable configs for the tools you're using. However if you need to share hook scripts using npm, you can do so this way:

```
// my-husky-scripts/index.js
module.exports = {
'pre-commit': 'echo hello'
}
```

```
npm install my-husky-scripts --save-dev
```

```sh
# .husky/pre-commit
# ...
eval "$(node -p "require('my-husky-scripts')['pre-commit']")"
```

# FAQ

## Does it work on Windows?
Expand Down

0 comments on commit d12efa2

Please sign in to comment.