diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a340ff25229..7f2162988ab 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -96,6 +96,7 @@ packages/app-check-interop-types @hsubox76 @firebase/jssdk-global-approvers # Documentation Changes packages/firebase/index.d.ts @egilmorez @firebase/jssdk-global-approvers scripts/docgen/content-sources/ @egilmorez @firebase/jssdk-global-approvers +docs-devsite/ @egilmorez @markarndt # Changeset -.changeset @egilmorez @firebase/jssdk-changeset-approvers @firebase/firestore-js-team @firebase/jssdk-global-approvers +.changeset @firebase/jssdk-changeset-approvers @firebase/firestore-js-team @firebase/jssdk-global-approvers \ No newline at end of file diff --git a/.github/workflows/check-docs.yml b/.github/workflows/check-docs.yml new file mode 100644 index 00000000000..bafc315bdf5 --- /dev/null +++ b/.github/workflows/check-docs.yml @@ -0,0 +1,28 @@ +name: Doc Change Check (Run "yarn docgen devsite" if this fails) + +on: pull_request + +jobs: + doc-check: + name: Check if reference docs have changed + runs-on: ubuntu-latest + + steps: + - name: Checkout Repo + uses: actions/checkout@master + with: + # get all history for the diff + fetch-depth: 0 + - name: Set up Node (14) + uses: actions/setup-node@v2 + with: + node-version: 14.x + - name: Yarn install + run: yarn + - name: Run doc generation (devsite docs) + run: yarn docgen devsite + - 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." \ No newline at end of file diff --git a/.github/workflows/label-doc-changes.yml b/.github/workflows/label-doc-changes.yml deleted file mode 100644 index 156fa49d975..00000000000 --- a/.github/workflows/label-doc-changes.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Label doc changes - -on: pull_request - -env: - GITHUB_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }} - GITHUB_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }} - -jobs: - check_doc_changes: - name: Check if docs are being changed - runs-on: ubuntu-latest - - steps: - - name: Checkout Repo - uses: actions/checkout@master - with: - # This makes Actions fetch all Git history so check_changeset script can diff properly. - fetch-depth: 0 - - name: Set up Node (14) - uses: actions/setup-node@v2 - with: - node-version: 14.x - - name: Yarn install - run: yarn - - name: Run detect doc changes script - run: yarn ts-node-script scripts/ci/detect-doc-changes.ts - id: check-doc-changes - - name: Print if doc changed output - run: echo "${{steps.check-doc-changes.outputs.DOC_CHANGED}}" - - name: Add label if there are doc changes - uses: actions-ecosystem/action-add-labels@v1.1.3 - if: ${{steps.check-doc-changes.outputs.DOC_CHANGED == 'true'}} - with: - labels: doc-changes - github_token: ${{ github.token }} - - name: assign techwriters to PR - if: ${{steps.check-doc-changes.outputs.DOC_CHANGED == 'true'}} - uses: kentaro-m/auto-assign-action@v1.2.1 - with: - configuration-path: ".github/auto_assign.yml" diff --git a/docs-devsite/firestore_.aggregatefield.md b/docs-devsite/firestore_.aggregatefield.md index 0c3957520b3..9d364a6abcc 100644 --- a/docs-devsite/firestore_.aggregatefield.md +++ b/docs-devsite/firestore_.aggregatefield.md @@ -22,7 +22,7 @@ export declare class AggregateField | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [type](./firestore_.aggregatefield.md#aggregatefieldtype) | | string | A type string to uniquely identify instances of this class. | +| [type](./firestore_.aggregatefield.md#aggregatefieldtype) | | (not declared) | A type string to uniquely identify instances of this class. | ## AggregateField.type @@ -31,5 +31,5 @@ A type string to uniquely identify instances of this class. Signature: ```typescript -type: string; +readonly type = "AggregateField"; ``` diff --git a/docs-devsite/firestore_.aggregatespec.md b/docs-devsite/firestore_.aggregatespec.md index be06b6941f3..7b430a4cb70 100644 --- a/docs-devsite/firestore_.aggregatespec.md +++ b/docs-devsite/firestore_.aggregatespec.md @@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # AggregateSpec interface -A type whose property values are all `AggregateField` objects. +Specifies a set of aggregations and their aliases. Signature: diff --git a/docs-devsite/firestore_.md b/docs-devsite/firestore_.md index 4a5c2dd49b2..058cdd7b281 100644 --- a/docs-devsite/firestore_.md +++ b/docs-devsite/firestore_.md @@ -134,7 +134,7 @@ https://github.com/firebase/firebase-js-sdk | Interface | Description | | --- | --- | -| [AggregateSpec](./firestore_.aggregatespec.md#aggregatespec_interface) | A type whose property values are all AggregateField objects. | +| [AggregateSpec](./firestore_.aggregatespec.md#aggregatespec_interface) | Specifies a set of aggregations and their aliases. | | [DocumentChange](./firestore_.documentchange.md#documentchange_interface) | A DocumentChange represents a change to the documents matching a query. It contains the document affected and the type of change that occurred. | | [DocumentData](./firestore_.documentdata.md#documentdata_interface) | Document data (for use with [setDoc()](./firestore_lite.md#setdoc)) consists of fields mapped to values. | | [FirestoreDataConverter](./firestore_.firestoredataconverter.md#firestoredataconverter_interface) | Converter used by withConverter() to transform user objects of type T into Firestore data.Using the converter allows you to specify generic type arguments when storing and retrieving objects from Firestore. | @@ -1946,7 +1946,7 @@ The union of all `AggregateField` types that are supported by Firestore. Signature: ```typescript -export declare type AggregateFieldType = AggregateField; +export declare type AggregateFieldType = AggregateField; ``` ## AggregateSpecData diff --git a/docs-devsite/firestore_lite.aggregatefield.md b/docs-devsite/firestore_lite.aggregatefield.md index 952b60c9d80..2376c50c41f 100644 --- a/docs-devsite/firestore_lite.aggregatefield.md +++ b/docs-devsite/firestore_lite.aggregatefield.md @@ -22,7 +22,7 @@ export declare class AggregateField | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [type](./firestore_lite.aggregatefield.md#aggregatefieldtype) | | string | A type string to uniquely identify instances of this class. | +| [type](./firestore_lite.aggregatefield.md#aggregatefieldtype) | | (not declared) | A type string to uniquely identify instances of this class. | ## AggregateField.type @@ -31,5 +31,5 @@ A type string to uniquely identify instances of this class. Signature: ```typescript -type: string; +readonly type = "AggregateField"; ``` diff --git a/docs-devsite/firestore_lite.aggregatespec.md b/docs-devsite/firestore_lite.aggregatespec.md index be06b6941f3..7b430a4cb70 100644 --- a/docs-devsite/firestore_lite.aggregatespec.md +++ b/docs-devsite/firestore_lite.aggregatespec.md @@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # AggregateSpec interface -A type whose property values are all `AggregateField` objects. +Specifies a set of aggregations and their aliases. Signature: diff --git a/docs-devsite/firestore_lite.md b/docs-devsite/firestore_lite.md index 3754cda22b7..3dc3dfe2388 100644 --- a/docs-devsite/firestore_lite.md +++ b/docs-devsite/firestore_lite.md @@ -108,7 +108,7 @@ https://github.com/firebase/firebase-js-sdk | Interface | Description | | --- | --- | -| [AggregateSpec](./firestore_lite.aggregatespec.md#aggregatespec_interface) | A type whose property values are all AggregateField objects. | +| [AggregateSpec](./firestore_lite.aggregatespec.md#aggregatespec_interface) | Specifies a set of aggregations and their aliases. | | [DocumentData](./firestore_lite.documentdata.md#documentdata_interface) | Document data (for use with [setDoc()](./firestore_lite.md#setdoc)) consists of fields mapped to values. | | [FirestoreDataConverter](./firestore_lite.firestoredataconverter.md#firestoredataconverter_interface) | Converter used by withConverter() to transform user objects of type T into Firestore data.Using the converter allows you to specify generic type arguments when storing and retrieving objects from Firestore. | | [Settings](./firestore_lite.settings.md#settings_interface) | Specifies custom configurations for your Cloud Firestore instance. You must set these before invoking any other methods. | @@ -1277,7 +1277,7 @@ The union of all `AggregateField` types that are supported by Firestore. Signature: ```typescript -export declare type AggregateFieldType = AggregateField; +export declare type AggregateFieldType = AggregateField; ``` ## AggregateSpecData diff --git a/scripts/docgen/docgen.ts b/scripts/docgen/docgen.ts index c2f39b24469..69224868397 100644 --- a/scripts/docgen/docgen.ts +++ b/scripts/docgen/docgen.ts @@ -136,6 +136,11 @@ async function generateDocs( `${projectRoot}/packages/auth/api-extractor.json`, 'utf8' ); + // Save original auth.md as well. + const authApiReportOriginal = fs.readFileSync( + `${projectRoot}/common/api-review/auth.api.md`, + 'utf8' + ); const authApiConfigModified = authApiConfigOriginal.replace( `"mainEntryPointFilePath": "/dist/esm5/index.d.ts"`, `"mainEntryPointFilePath": "/dist/esm5/index.doc.d.ts"` @@ -145,14 +150,27 @@ async function generateDocs( authApiConfigModified ); - if (!skipBuild) { - await spawn('yarn', ['build'], { - stdio: 'inherit' - }); - + if (skipBuild) { await spawn('yarn', ['api-report'], { stdio: 'inherit' }); + } else { + // api-report is run as part of every build + await spawn( + 'yarn', + [ + 'lerna', + 'run', + '--scope', + '@firebase/*', + '--ignore', + '@firebase/*-compat', + 'build' + ], + { + stdio: 'inherit' + } + ); } // Restore original auth api-extractor.json contents. @@ -160,6 +178,11 @@ async function generateDocs( `${projectRoot}/packages/auth/api-extractor.json`, authApiConfigOriginal ); + // Restore original auth.api.md + fs.writeFileSync( + `${projectRoot}/common/api-review/auth.api.md`, + authApiReportOriginal + ); if (!fs.existsSync(tmpDir)) { fs.mkdirSync(tmpDir);