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 |
| "fbjs": "0.8.17", | ||
| "glob": "7.1.2", | ||
| "husky": "3.0.5", | ||
| "husky": "2.7.0", |
There was a problem hiding this comment.
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.
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.
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.jsgit add packages/core-data/src/actions.jsgit 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: