-
Notifications
You must be signed in to change notification settings - Fork 62
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
ghooks configuration #81
Conversation
Meh. CI builds seem to fail due to a bug in |
expect(getConfig()).to.deep.equal(expectedConfig) | ||
}) | ||
|
||
it('reads custom configuration and hooks (overriding the deprecated way)', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great coverage!
This looks awesome!
There's technically nothing breaking about this right? Unless I misunderstand what's going on here, it looks like we're just adding the ability to configure things. Seems fine to me. When we remove the ability to do the old stuff then we can version bump. But it looks like we've got backward compat right now. |
Yes, technically there shouldn't be anything breaking; I guess I only wanted to "feel" safe after "exit with error-gate" 😜 Atm I have the following steps on my todo list for the upcoming days:
Please drop me a line here, if you'd prefer to put the (re-)implementation of "exit with error" into a separate PR (on the other hand, there would be no need for these changes, when there's nothing to configure). ... and thanks for taking the time to review this! |
2f5c096
to
d128feb
Compare
I'm fine doing this in the same PR as long as it's backward compatible 👍 |
// it gets substituted on ghooks' setup | ||
// {{generated_config_start}} | ||
return global.__testonly_ghooksConfig__ || {} | ||
// {{generated_config_end}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
global.__testonly_ghooksConfig__
is atm required to thoroughly test the optional behavior to exit with an error.
The whole block from {{generated_config_start}}
to {{generated_config_end}}
(including their comments) gets replaced when rendering the current config into the hook.template
.
As a side note:
The hooks
also get rendered into the template. I was unsure whether to ditch them, but maybe we can make use of them at a later point.
Hey everyone, really sorry for the silence… This looks great! One other option, that just occurred me, could be simply having another
If I correctly got what you're saying, I believe we can already re-run it with |
I'd be fine having a separate |
I thought an example would be useful… 😛 {
"config": {
"ghooks": {
"pre-commit": "",
…
},
"ghooks-settings": {
"exitWithError": true
}
}
} gonna sleep now, it's freaking 3am here o_O |
It was mostly because of » Some place was concluded that it would be nice to eventually have "config": {
"ghooks": {
"randomConfig": ["randomValue"],
"hooks": {
"pre-commit": "echo \"some pre-commit hook\"
}
} and to allow I should have some more time in the upcoming days, I'll at least update this PR / resolve the conflicts, so we'd have a clean status we'd be talking about ... |
51c717e
to
9a1dc4f
Compare
Current coverage is 100%@@ master #81 diff @@
======================================
Files 4 5 +1
Lines 114 166 +52
Methods 0 7 +7
Branches 4 6 +2
======================================
+ Hits 114 166 +52
Misses 0 0
Partials 0 0
|
bf49af4
to
32697d0
Compare
Allow ghooks to be configured more detailed via config.ghooks.[option] in package.json. Hooks are now to be configured via the new config.ghooks.hooks config-object in package.json. (Still valid, but considered deprecated: config.ghooks.[hookname]).
Required on node 0.10
32697d0
to
0b374f9
Compare
Jesus Christ, that GitCop tried hard to get me arrested for being too verbose . . . 😞 |
😆 I guess I should tune it down a little… |
What do you think about warning the developer if they are using the deprecated (hopefully soon-to-be removed) way? |
Absolutely! I'm just unsure as where to output the warning (as in, on every invokation of a hook, only on the hooks' installation/setup, ...). |
Re: GitCop, it seemed like a good idea at the time, but.... I don't use it anymore. Just too heavy handed and not flexible. |
Closing this one as there will be no future development in |
This PR introduces the ability to configure ghooks more detailed (as originally proposed here).
In
package.json
:Replaces the old way (still working, but considered deprecated):
The idea behind this PR is, for example to prepare ghooks to be able to optionally exit the hooks with a non-zero code (an error) if
ghooks
could not be loaded successfully. Therefore, I consider this PR as work in progress, until that particular feature can be (safely, this time) enabled again.So in order to re-implement an »exit with error« functionality, I'd like to know what way to approach this would be the most adequate:
install
, check the config whether to »exit with error« and write the hooks' script accordinglypackage.json
and read the config, not exiting with an error if nothing explicitly states so.When going route 1, I'd suggest making the
install
script "re-runnable", by adding it asbin.ghooks
to thepackage.json
.@gtramontina @kentcdodds I'd like to hear from you what your thoughts are about this proposal (if/when you got time for this — no need to hurry).
Edit: If this gets merged eventually, I'd propose we call this a breaking change to trigger a major version bump?