Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-git-hooks

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-git-hooks

Automate git hook deployment

  • 1.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29K
increased by1.03%
Maintainers
1
Weekly downloads
 
Created
Source

Cross-Platform Installation of Git Hooks

Git hooks are a powerful tool to help developers maintain consistency in their code. Unfortunately hooks are not part of the repository and thus require developers to manually set up and/or install them. There are a number of projects that address this, but they are not as automated, deployment-friendly, or cross-platform.

Node JS for Cross-Platform Support

Instead of using shell scripts which are dependent on the OS, this project uses Node to abstract filesystem operations. This allows it to run on Linux, OSX, Windows, any OS supported by Node.

Deployment Friendly

While automated installation of Git hooks is great for developers, it can cause problems during deployment. If an npm package post-installs hooks inside node_modules, build systems may throw the error Appears to be a git repo or submodule. This project will only copy hooks if the .git folder exists.

Installation

npm install node-git-hooks --save

Usage

Create a .githooks folder and place hooks inside named corresponding to what they should be in .git/hooks. For example, the script pre-commit runs before a commit and is often used to perform linting.

Add the following postinstall script to package.json:

"scripts": {
  "postinstall": "node-git-hooks"
},

Keywords

FAQs

Package last updated on 14 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc