Skip to content

Commit

Permalink
Add docgen all script and update documentation (#8258)
Browse files Browse the repository at this point in the history
* Add docgen all script and update documentation

* Move toc to devsite, and rename to `_toc.yaml`

* Fix formatting

* Remove seperate toc CI check

* Update Contributing guide

* revert changes made to refdocs
  • Loading branch information
dlarocque authored Jun 4, 2024
1 parent 872e6f6 commit 92a39b5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Doc Change Check (Run "yarn docgen devsite" if this fails)
name: Doc Change Check (Run "yarn docgen:all" if this fails)

on: pull_request

Expand All @@ -33,10 +33,10 @@ jobs:
node-version: 20.x
- name: Yarn install
run: yarn
- name: Run doc generation (devsite docs)
run: yarn docgen devsite
- name: Run doc generation
run: yarn docgen:all
- name: Check for changes in docs-devsite dir (fail if so)
run: git diff --exit-code docs-devsite
- name: Reference documentation needs to be updated. See message below.
if: ${{ failure() }}
run: echo "Changes in this PR affect the reference docs. Run \`yarn docgen devsite\` locally to regenerate docs and add them to this PR."
run: echo "Changes in this PR affect the reference docs. Run \`yarn docgen:all\` locally to regenerate docs and add them to this PR."
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@ root directory to generate the documentation locally:
```
yarn
yarn docgen devsite
yarn docgen:all
```
This will generate reference docs in `docs-devsite/`. Commit and push the generated
This will generate reference docs and the toc in `docs-devsite/`. Commit and push the generated
documentation changes to GitHub following the [PR submission guidelines](#submit). Your push
to the remote repository should force any failing documentation checks to execute again.
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"test:saucelabs": "node scripts/run_saucelabs.js",
"docgen": "ts-node-script scripts/docgen/docgen.ts",
"docgen:compat": "node scripts/docgen-compat/generate-docs.js --api js",
"docgen:all": "yarn docgen devsite && yarn docgen toc",
"lint": "lerna run --scope @firebase/* lint",
"lint:fix": "lerna run --scope @firebase/* lint:fix",
"size-report": "ts-node-script scripts/size_report/report_binary_size.ts",
Expand Down
6 changes: 6 additions & 0 deletions scripts/docgen/docgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,18 @@ async function generateToc() {
'toc',
'--input',
'temp',
'--output',
'docs-devsite',
'-p',
'/docs/reference/js',
'-j'
],
{ stdio: 'inherit' }
);
// The toc on the devsite must be named _toc.yaml
await spawn('mv', ['docs-devsite/toc.yaml', 'docs-devsite/_toc.yaml'], {
stdio: 'inherit'
});
} finally {
cleanup();
}
Expand Down

0 comments on commit 92a39b5

Please sign in to comment.