Skip to content

Commit 75d4a9a

Browse files
authored
Simplify check for reference doc changes (#7014)
1 parent c8a6e08 commit 75d4a9a

10 files changed

+68
-57
lines changed

.github/CODEOWNERS

+2-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ packages/app-check-interop-types @hsubox76 @firebase/jssdk-global-approvers
9696
# Documentation Changes
9797
packages/firebase/index.d.ts @egilmorez @firebase/jssdk-global-approvers
9898
scripts/docgen/content-sources/ @egilmorez @firebase/jssdk-global-approvers
99+
docs-devsite/ @egilmorez @markarndt
99100

100101
# Changeset
101-
.changeset @egilmorez @firebase/jssdk-changeset-approvers @firebase/firestore-js-team @firebase/jssdk-global-approvers
102+
.changeset @firebase/jssdk-changeset-approvers @firebase/firestore-js-team @firebase/jssdk-global-approvers

.github/workflows/check-docs.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Doc Change Check (Run "yarn docgen devsite" if this fails)
2+
3+
on: pull_request
4+
5+
jobs:
6+
doc-check:
7+
name: Check if reference docs have changed
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout Repo
12+
uses: actions/checkout@master
13+
with:
14+
# get all history for the diff
15+
fetch-depth: 0
16+
- name: Set up Node (14)
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: 14.x
20+
- name: Yarn install
21+
run: yarn
22+
- name: Run doc generation (devsite docs)
23+
run: yarn docgen devsite
24+
- name: Check for changes in docs-devsite dir (fail if so)
25+
run: git diff --exit-code docs-devsite
26+
- name: Reference documentation needs to be updated. See message below.
27+
if: ${{ failure() }}
28+
run: echo "Changes in this PR affect the reference docs. Run \`yarn docgen devsite\` locally to regenerate docs and add them to this PR."

.github/workflows/label-doc-changes.yml

-41
This file was deleted.

docs-devsite/firestore_.aggregatefield.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export declare class AggregateField<T>
2222

2323
| Property | Modifiers | Type | Description |
2424
| --- | --- | --- | --- |
25-
| [type](./firestore_.aggregatefield.md#aggregatefieldtype) | | string | A type string to uniquely identify instances of this class. |
25+
| [type](./firestore_.aggregatefield.md#aggregatefieldtype) | | (not declared) | A type string to uniquely identify instances of this class. |
2626

2727
## AggregateField.type
2828

@@ -31,5 +31,5 @@ A type string to uniquely identify instances of this class.
3131
<b>Signature:</b>
3232

3333
```typescript
34-
type: string;
34+
readonly type = "AggregateField";
3535
```

docs-devsite/firestore_.aggregatespec.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# AggregateSpec interface
13-
A type whose property values are all `AggregateField` objects.
13+
Specifies a set of aggregations and their aliases.
1414

1515
<b>Signature:</b>
1616

docs-devsite/firestore_.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ https://github.com/firebase/firebase-js-sdk
134134

135135
| Interface | Description |
136136
| --- | --- |
137-
| [AggregateSpec](./firestore_.aggregatespec.md#aggregatespec_interface) | A type whose property values are all <code>AggregateField</code> objects. |
137+
| [AggregateSpec](./firestore_.aggregatespec.md#aggregatespec_interface) | Specifies a set of aggregations and their aliases. |
138138
| [DocumentChange](./firestore_.documentchange.md#documentchange_interface) | A <code>DocumentChange</code> represents a change to the documents matching a query. It contains the document affected and the type of change that occurred. |
139139
| [DocumentData](./firestore_.documentdata.md#documentdata_interface) | Document data (for use with [setDoc()](./firestore_lite.md#setdoc)<!-- -->) consists of fields mapped to values. |
140140
| [FirestoreDataConverter](./firestore_.firestoredataconverter.md#firestoredataconverter_interface) | Converter used by <code>withConverter()</code> to transform user objects of type <code>T</code> 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.
19461946
<b>Signature:</b>
19471947

19481948
```typescript
1949-
export declare type AggregateFieldType = AggregateField<number>;
1949+
export declare type AggregateFieldType = AggregateField<number | null>;
19501950
```
19511951

19521952
## AggregateSpecData

docs-devsite/firestore_lite.aggregatefield.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export declare class AggregateField<T>
2222

2323
| Property | Modifiers | Type | Description |
2424
| --- | --- | --- | --- |
25-
| [type](./firestore_lite.aggregatefield.md#aggregatefieldtype) | | string | A type string to uniquely identify instances of this class. |
25+
| [type](./firestore_lite.aggregatefield.md#aggregatefieldtype) | | (not declared) | A type string to uniquely identify instances of this class. |
2626

2727
## AggregateField.type
2828

@@ -31,5 +31,5 @@ A type string to uniquely identify instances of this class.
3131
<b>Signature:</b>
3232

3333
```typescript
34-
type: string;
34+
readonly type = "AggregateField";
3535
```

docs-devsite/firestore_lite.aggregatespec.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# AggregateSpec interface
13-
A type whose property values are all `AggregateField` objects.
13+
Specifies a set of aggregations and their aliases.
1414

1515
<b>Signature:</b>
1616

docs-devsite/firestore_lite.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ https://github.com/firebase/firebase-js-sdk
108108

109109
| Interface | Description |
110110
| --- | --- |
111-
| [AggregateSpec](./firestore_lite.aggregatespec.md#aggregatespec_interface) | A type whose property values are all <code>AggregateField</code> objects. |
111+
| [AggregateSpec](./firestore_lite.aggregatespec.md#aggregatespec_interface) | Specifies a set of aggregations and their aliases. |
112112
| [DocumentData](./firestore_lite.documentdata.md#documentdata_interface) | Document data (for use with [setDoc()](./firestore_lite.md#setdoc)<!-- -->) consists of fields mapped to values. |
113113
| [FirestoreDataConverter](./firestore_lite.firestoredataconverter.md#firestoredataconverter_interface) | Converter used by <code>withConverter()</code> to transform user objects of type <code>T</code> into Firestore data.<!-- -->Using the converter allows you to specify generic type arguments when storing and retrieving objects from Firestore. |
114114
| [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.
12771277
<b>Signature:</b>
12781278

12791279
```typescript
1280-
export declare type AggregateFieldType = AggregateField<number>;
1280+
export declare type AggregateFieldType = AggregateField<number | null>;
12811281
```
12821282

12831283
## AggregateSpecData

scripts/docgen/docgen.ts

+28-5
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ async function generateDocs(
136136
`${projectRoot}/packages/auth/api-extractor.json`,
137137
'utf8'
138138
);
139+
// Save original auth.md as well.
140+
const authApiReportOriginal = fs.readFileSync(
141+
`${projectRoot}/common/api-review/auth.api.md`,
142+
'utf8'
143+
);
139144
const authApiConfigModified = authApiConfigOriginal.replace(
140145
`"mainEntryPointFilePath": "<projectFolder>/dist/esm5/index.d.ts"`,
141146
`"mainEntryPointFilePath": "<projectFolder>/dist/esm5/index.doc.d.ts"`
@@ -145,21 +150,39 @@ async function generateDocs(
145150
authApiConfigModified
146151
);
147152

148-
if (!skipBuild) {
149-
await spawn('yarn', ['build'], {
150-
stdio: 'inherit'
151-
});
152-
153+
if (skipBuild) {
153154
await spawn('yarn', ['api-report'], {
154155
stdio: 'inherit'
155156
});
157+
} else {
158+
// api-report is run as part of every build
159+
await spawn(
160+
'yarn',
161+
[
162+
'lerna',
163+
'run',
164+
'--scope',
165+
'@firebase/*',
166+
'--ignore',
167+
'@firebase/*-compat',
168+
'build'
169+
],
170+
{
171+
stdio: 'inherit'
172+
}
173+
);
156174
}
157175

158176
// Restore original auth api-extractor.json contents.
159177
fs.writeFileSync(
160178
`${projectRoot}/packages/auth/api-extractor.json`,
161179
authApiConfigOriginal
162180
);
181+
// Restore original auth.api.md
182+
fs.writeFileSync(
183+
`${projectRoot}/common/api-review/auth.api.md`,
184+
authApiReportOriginal
185+
);
163186

164187
if (!fs.existsSync(tmpDir)) {
165188
fs.mkdirSync(tmpDir);

0 commit comments

Comments
 (0)