Skip to content

shardeum/git-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Git hooks for Shardeum repositories

Installing these hooks on a repository

  1. Install and save Husky as a dev dependency:

    npm install --save-dev husky
  2. Add this repository as a submodule in the .husky directory:

    git submodule add [email protected]:shardeum/git-hooks .husky
  3. Initialize Husky:

    npx husky init

    You will notice that husky has added or modified the prepare script in package.json. If it was modified, you can add the old prepare script back as a postprepare script, e.g.

    {
      // ...
      "prepare": "husky",
      "postprepare": "npm run compile",
      // ...
    }
  4. Modify the prepare script in package.json to automatically initialize this submodule for other developers:

    {
      // ...
      "prepare": "git submodule update --init && husky",
      // ...
    }

    Husky will install hooks automatically when developers run npm install.

Important

Don't skip this last step! Developers will have to manually clone or initialize hooks otherwise, and hooks won't be executed until they do.

Updating hooks in repositories

Hooks are installed via this submodule method in order to more easily and effectively propagate changes to other repositories. If updates are made to the hooks in this repository, they can be pulled and updated in other repositories by updating the submodule:

git submodule update --remote

Important

Remember to git add .husky && git commit the update!

About

Git hooks installed via husky.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages