-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add a pre-commit hook to check whether API docs are updated #18820
Conversation
What would need to be done to reconcile this with #18840, notably that I've removed the explicit list of packages in that pull request. |
I'm fine with whatever approach that gets both shipped fast. It looks like this PR makes less changes to |
This needs to take also into account potential changes to handbook's API docs as well. Updated the testing instructions to reflect that. Update: done this at 14f3a3b |
package.json
Outdated
@@ -120,7 +120,7 @@ | |||
"fast-glob": "2.2.7", | |||
"fbjs": "0.8.17", | |||
"glob": "7.1.2", | |||
"husky": "3.0.5", | |||
"husky": "2.7.0", |
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.
Was it intentional to downgrade? I would expect it would need corresponding changes to package-lock.json
if intended.
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.
I need to revert this.
For context: when we updated husky from 0 to 3 we introduced a breaking change: the git version required to work with husky is >= 2.13.2
. Git hooks won't be executed in versions below. The git version bundled with my OS is lower than that, so I can't run the hooks (and test this change), so I had to downgrade it for testing.
I asked in core-editor about this change and it doesn't seem a widespread issue. Wasn't able to pin down easily the git versions that come with the supported OS for Windows and Mac to gauge how many could be affected. I guessed another way to look at it was that if people don't complain about hooks not executing for them, it's not an issue.
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.
This PR is an alternative to #18657 Instead of automatically adding files to the commit (which could be problematic) this goes the route of checking whether the API docs are unstaged: if so, the commit will be prevented and the user has the choice of either adding them to the commit or skipping the check.
Test instructions
packages/core-data/src/actions.js
git add packages/core-data/src/actions.js
git commit -m 'testing'
The expected result is that you can't commit due to the unstaged README files that were auto-updated due to the code change and will see a message like: