leonsilicon / lion-git-hooks

A fork of simple-git-hooks with additional features that fit my personal use case.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lion Git Hooks

npm version

This is a fork of simple-git-hooks by toplenboren that adds some extra features for my personal use case.

Usage

Install the package from npm:

npm install --save-dev lion-git-hooks

Then, add the following in your package.json

{
  // ...
  "scripts": {
    "prepare": "lion-git-hooks"
    // ...
  }
}

Then, create the following folder in your project root:

# Navigate to the root of your project
cd my-project

# Create a `scripts/hooks` folder in your project root (`lion-git-hooks` also reads from `scripts/src/hooks` as well in case you use a `src` folder in your `scripts` folder)
mkdir -p scripts/hooks

# Create files for the git hooks you want to run
echo 'console.log("commit-msg")' > scripts/hooks/commit-msg.ts
echo 'console.log("pre-commit")' > scripts/pre-commit.ts
echo 'console.log("pre-push")' > scripts/pre-push.ts

Then, modify the scripts/hooks/*.ts files to contain the code you want to run for the respective git hook.

About

A fork of simple-git-hooks with additional features that fit my personal use case.

License:MIT License


Languages

Language:TypeScript 88.0%Language:JavaScript 12.0%