From a211619aa5395faabadd3f206fe8b29c93a82d1d Mon Sep 17 00:00:00 2001 From: GP Date: Fri, 30 Apr 2021 11:44:42 +0530 Subject: [PATCH 1/2] docs: Add examples for configuring with lefthook --- README.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e7f9ad..9b71eb0 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ npm install --save-dev git-notify yarn add -D git-notify ``` -Next, we'll configure `git-notify` to run automatically when other developers pull commits that contain git messages. Below we show how to achieve this with the excellent [husky](https://github.com/typicode/husky) library. For other approaches, see the [Git Hooks](#git-hooks) section later in this document. +Next, we'll configure `git-notify` to run automatically when other developers pull commits that contain git messages. Below we show how to achieve this with the excellent [husky](https://github.com/typicode/husky) and [lefthook](https://github.com/evilmartians/lefthook#lefthook) libraries. For other approaches, see the [Git Hooks](#git-hooks) section later in this document. ### Installing hooks with husky @@ -67,6 +67,34 @@ Configure `git-notify` hooks by adding the following `husky` entries to your `pa _**Note:** The above instructions below are for [husky v4.x](https://github.com/typicode/husky/tree/master). Husky v5 has changed how hooks are configured, as well updated its licensing terms to be free only to other open source projects.See [husky's own documentation](https://dev.to/typicode/what-s-new-in-husky-5-32g5) for how to configure hooks in their latest version._ +### Installing hooks with lefthook + +``` +# using npm +npm install --save-dev @arkweid/lefthook + +# using yarn +yarn add -D @arkweid/lefthook +``` + +Configure `git-notify` hooks by adding the following entries to your `lefthook.yml`: + +```yaml +post-merge: + commands: + notify: + run: "git-notify merge {0}" +post-rewrite: + commands: + notify: + run: "git-notify merge {0}" +post-checkout: + commands: + notify: + run: "git-notify merge {0}" + +``` + ## Configuration - `git-notify --prefix "@everyone"` @@ -167,6 +195,10 @@ Not at the moment, but this should not be difficult to add. See [Contributing](# See [Installing hooks with husky](#installing-hooks-with-husky) in the Getting Started section. +### Installing with lefthook + +See [Installing hooks with lefthook](#installing-hooks-with-lefthook) in the Getting Started section. + ### Installing hooks by any other means `git-notify` is agnostic to however you want to install your git hooks. From 49cf510a18d614eb2d3a74a784c3c6a62c28e5e2 Mon Sep 17 00:00:00 2001 From: GP Date: Mon, 3 May 2021 16:26:22 +0530 Subject: [PATCH 2/2] docs: Use npx to execute lefthook. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9b71eb0..ce7a184 100644 --- a/README.md +++ b/README.md @@ -83,15 +83,15 @@ Configure `git-notify` hooks by adding the following entries to your `lefthook.y post-merge: commands: notify: - run: "git-notify merge {0}" + run: "npx git-notify merge {0}" post-rewrite: commands: notify: - run: "git-notify merge {0}" + run: "npx git-notify merge {0}" post-checkout: commands: notify: - run: "git-notify merge {0}" + run: "npx git-notify merge {0}" ```