Skip to content

Commit

Permalink
chore: ensure new-docs are up to date (#5994)
Browse files Browse the repository at this point in the history
* chore: ensure new-docs are up to date

This adds a Travis check that if we re-generate the docs we get the
exact output (by checking if the Git tree is dirty).

We do the dirty check by using `git status --porcelain`, seeing how many
lines that outputs, and using that as the exit code (taking only the
first 255 lines to avoid invalid exit codes). `--porcelain` makes the
output be empty if the repo is not dirty in anyway which translates into
an exit code of 0.

We can't use `git diff-index --quiet HEAD` as it exits with 0 if there are
untracked files in the repo but we want that to cause a failure.
  • Loading branch information
jackfranklin committed Jun 11, 2020
1 parent b86ff21 commit 91eb745
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -67,6 +67,7 @@ jobs:
- npm run test-install
- npm run lint
- npm run test-doclint
- npm run ensure-new-docs-up-to-date

# Runs unit tests on Linux + Firefox
- node_js: "10.19.0"
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -33,7 +33,8 @@
"update-protocol-d-ts": "node utils/protocol-types-generator update",
"compare-protocol-d-ts": "node utils/protocol-types-generator compare",
"test-install": "scripts/test-install.sh",
"generate-docs": "npm run tsc && api-extractor run --local --verbose && api-documenter markdown -i temp -o new-docs"
"generate-docs": "npm run tsc && api-extractor run --local --verbose && api-documenter markdown -i temp -o new-docs",
"ensure-new-docs-up-to-date": "npm run generate-docs && exit `git status --porcelain | head -255 | wc -l`"
},
"files": [
"lib/",
Expand Down

0 comments on commit 91eb745

Please sign in to comment.