Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more methods for defining config/hooks #209

Merged
merged 1 commit into from
Nov 28, 2017

Conversation

vinsidious
Copy link

Overview

This PR makes it so that users can specify their hooks in a few more ways besides a top-level key in their package.json. This is accomplished by using cosmiconfig which would add support for:

  • A .huskyrc, .huskyrc.json, or .huskyrc.y[a]ml file
  • A husky.config.js file that exports a config object

Motivation

My team is already using husky and we want to move to the beta version due to its speed improvements but we're not too keen on adding a new top-level key in our package.json. We'd much prefer a .huskyrc file which would lead to a clearer separation of concerns and follow an existing pattern that is already in use by many packages.

@typicode typicode merged commit 33de5f9 into typicode:dev Nov 28, 2017
@typicode
Copy link
Owner

Thank you!

@typicode
Copy link
Owner

Just published new beta version v0.15.0-beta.14 :)

@vinsidious
Copy link
Author

Thank you for accepting the PR and for the quick turnaround @typicode!

@3z3qu13l
Copy link

3z3qu13l commented Sep 26, 2018

Hello,
Would you have an example of huskyrc ?
@vinsidious our motivation are identical :)

@typicode
Copy link
Owner

Hello @3z3qu13l,

Yes, here:
https://raw.githubusercontent.com/typicode/husky/master/.huskyrc

I'm using it to test on the CI, but basically the format is the same as in package.json. You just don't need to put "husky" field.

Here's another example using .js:

// .huskyrc.js
module.exports = {
  hooks: {
    'pre-commit': 'npm test'
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants