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

@retailmenot/grunt-hooks

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@retailmenot/grunt-hooks

Grunt multi-task for installing predefined git hooks.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@retailmenot/grunt-hooks

Grunt multi-task for installing predefined git hooks.

Usage

Place any git hooks you'd like installed in a <project root>/grunt/hooks/ directory (this location can be overridden).

Add options to your Gruntfile for each hook you'd like to prompt the user about.

Sample Config

{
    main: {
        options: {
            onDone: 'Thanks for being a good citizen and using the hooks.',
            hooks: [ {
                name: 'post-commit',
                hookType: 'post-commit',
                description: [
                    'inform the dev about the current state of the branch.',
                    'This will spit out jshint errors, but not fail if present.'
                ].join( '\n' )
            }, {
                name: 'pre-push',
                hookType: 'pre-push',
                description: 'ensure that there are no build or workflow-breaking issues.'
            }, {
                name: 'prepare-commit-msg',
                hookType: 'prepare-commit-msg',
                description: [ 'prepend commit messages with the',
                    'proper tag for branches that match the UI-* naming pattern.'
                ].join( '\n' )
            } ]
        }
    }
}

Options

onDone

String to present to the user after they have stepped through all of the hooks.

hookDir

Override the default directory from which hooks are sourced. (<project root>/grunt/hooks/)

hooks[]

Array of objects. Each object specifies options for a particular hook.

hook options
KeyDescription
nameCanonical name for the hook. This should be user readable.
hookTypeThe type of hook this should be installed as. This should correspond to one of the possible git hooks.
descriptionDescribe what the hook does. This will be prepended with "This hook will", so the description should pick up and finish that sentence.

Flags

--no-prompt

Causes the task to run without prompting the user. It is assumed that all questions are answered yes. This means running with this option will overwrite existing hooks of the same name within the repo.

Sample Run of Hooks

$ grunt hooks
Running "hooks:main" (hooks) task
post-commit
===========
This hook will inform the dev about the current state of the branch.
This will spit out jshint errors, but not fail if present.

Do you want to install this hook?
prompt: Y/N?:  y
A hook already exists at .git/hooks/post-commit. Do you wish to overwrite it?
prompt: Y/N?:  y
Installed post-commit hook in .git/hooks/post-commit
pre-push
========
This hook will ensure that there are no build or workflow-breaking issues.

Do you want to install this hook?
prompt: Y/N?:  y
grunt/hooks/pre-push .git/hooks/pre-push pre-push
Installed pre-push hook in .git/hooks/pre-push
prepare-commit-msg
==================
This hook will prepend commit messages with the
proper tag for branches that match the UI-* naming pattern.

Do you want to install this hook?
prompt: Y/N?:  y
y
A hook already exists at .git/hooks/prepare-commit-msg. Do you wish to overwrite it?
prompt: Y/N?:  y
Installed prepare-commit-msg hook in .git/hooks/prepare-commit-msg

Thanks for being a good citizen and using the hooks.

Done, without errors.

FAQs

Package last updated on 27 Sep 2016

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