You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/scripts/compare-types/README.md
+31-29Lines changed: 31 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,16 @@ For each registered package it compares the **modular** public API exported by t
10
10
|**Extra in RN Firebase**| Export exists in the RN package but not in the firebase-js-sdk |
11
11
|**Different shape**| Same name, but the type signature or interface members differ |
12
12
13
-
Every difference must have an entry in the package's `config.ts` explaining why it exists. The script exits with code 1, failing CI, if either:
13
+
Every difference must have an entry in the package's `configs/<package-name>.ts` explaining why it exists. The script exits with code 1, failing CI, if either:
14
14
15
-
- A difference is **undocumented** — add it to `config.ts` with a reason, or fix the RN Firebase types to match.
16
-
- A config entry is **stale** — the API now matches the firebase-js-sdk, so the entry should be removed from `config.ts`.
15
+
- A difference is **undocumented** — add it to `configs/<package-name>.ts` with a reason, or fix the RN Firebase types to match.
16
+
- A config entry is **stale** — the API now matches the firebase-js-sdk, so the entry should be removed from `configs/<package-name>.ts`.
17
17
18
18
## Prerequisites
19
19
20
-
The RN Firebase package(s) must be built before running the script, because the script reads from the compiled `dist/typescript/lib/` files:
20
+
The root repository dependencies must be installed because the script reads the Firebase JS SDK types from the installed root `node_modules/firebase` package.
21
+
22
+
The RN Firebase package(s) must also be built before running the script, because the script reads from the compiled `dist/typescript/lib/` files:
21
23
22
24
```sh
23
25
yarn
@@ -54,16 +56,16 @@ yarn compare
54
56
rn: (RemoteConfig) => ConfigValues
55
57
...
56
58
57
-
✓ All 17 difference(s) are documented in config.ts
59
+
✓ All 17 difference(s) are documented in configs/<name>.ts
58
60
```
59
61
60
62
```
61
63
📦 storage
62
64
63
65
Stale config entries (1):
64
-
✗ uploadString [STALE] — now matches the firebase-js-sdk; remove from config.ts
66
+
✗ uploadString [STALE] — now matches the firebase-js-sdk; remove from configs/<name>.ts
65
67
66
-
✗ 1 stale config entry/entries — remove them from config.ts
68
+
✗ 1 stale config entry/entries — remove them from configs/<name>.ts
compare.ts Diffs two export maps and classifies each difference.
82
84
Cross-references against the package config to split documented
83
85
from undocumented differences, and detects stale config entries
@@ -88,8 +90,10 @@ src/
88
90
89
91
packages/
90
92
<package-name>/
91
-
firebase-sdk.d.ts Snapshot of the firebase-js-sdk public types for this package.
92
-
config.ts Documented known differences for this package.
93
+
(obsolete snapshots should not be added here)
94
+
95
+
configs/
96
+
<package-name>.ts Documented known differences for this package.
93
97
```
94
98
95
99
### Type shapes
@@ -107,17 +111,17 @@ Shapes are compared as normalised strings. Semantically equivalent types that ar
107
111
108
112
## Adding a new package
109
113
110
-
### 1. Get the firebase-js-sdk public types
114
+
### 1. Confirm the firebase-js-sdk public types
111
115
112
-
Copy the public type declarations for the package from the firebase-js-sdk release into a new file:
116
+
The script reads Firebase JS SDK public declarations from the root `node_modules/firebase`package. Confirm the package exposes the modular public type entry in `node_modules/firebase/package.json`:
The file should contain only the **modular** (tree-shakeable) public exports — interfaces, type aliases, and `declare function` declarations. Strip internal/private types.
119
-
120
-
> In the future this step will be automated: a CI job will clone the firebase-js-sdk, run `yarn && yarn build`, and extract the generated `.d.ts` files automatically.
124
+
Those wrapper files often re-export public declarations from `@firebase/<package-name>`, and the parser resolves that chain through root `node_modules`.
121
125
122
126
### 2. Identify the RN Firebase modular files
123
127
@@ -134,10 +138,10 @@ Also note any **support files** — files that are re-exported from the modular
134
138
135
139
### 3. Create the config file
136
140
137
-
Create `packages/<package-name>/config.ts` with a `PackageConfig` object:
141
+
Create `configs/<package-name>.ts` with a `PackageConfig` object:
@@ -202,7 +204,7 @@ import newPackageConfig from '../packages/<package-name>/config';
202
204
203
205
### 5. Verify
204
206
205
-
Build the package and run the script. Any undocumented differences will be printed in red — add them to `config.ts` with a reason, or fix the RN Firebase types to match the SDK.
207
+
Build the package and run the script. Any undocumented differences will be printed in red — add them to `configs/<package-name>.ts` with a reason, or fix the RN Firebase types to match the SDK.
206
208
207
209
```sh
208
210
# from repo root
@@ -212,21 +214,21 @@ yarn compare:types
212
214
213
215
---
214
216
215
-
## Updating a package's firebase-sdk snapshot
217
+
## Updating the Firebase SDK reference
216
218
217
219
When a new firebase-js-sdk version ships with type changes:
218
220
219
-
1.Copy the updated public types from `node_modules/@firebase/<package>/dist/index.d.ts` (or the equivalent built output) into `packages/<package-name>/firebase-sdk.d.ts`.
221
+
1.Update the root `firebase` dependency and run `yarn` from the repository root.
220
222
2. Run `yarn compare:types`.
221
223
3. Any newly introduced differences will be flagged as undocumented. Either:
222
224
- Update the RN Firebase types to match, or
223
-
- Add a new entry to `config.ts` explaining why the difference is intentional.
224
-
4. Any config entries that the SDK change has now made redundant will be flagged as **stale**. Remove them from `config.ts`.
225
+
- Add a new entry to `configs/<package-name>.ts` explaining why the difference is intentional.
226
+
4. Any config entries that the SDK change has now made redundant will be flagged as **stale**. Remove them from `configs/<package-name>.ts`.
225
227
226
228
## Resolving a known difference in RN Firebase
227
229
228
230
When the RN Firebase types are updated to match the firebase-js-sdk for a previously documented difference:
229
231
230
232
1. Update the RN Firebase types and rebuild the package.
231
233
2. Run `yarn compare:types`.
232
-
3. The resolved entry will be flagged as **stale** (`✗ [STALE]`). Remove it from `config.ts`.
234
+
3. The resolved entry will be flagged as **stale** (`✗ [STALE]`). Remove it from `configs/<package-name>.ts`.
'RN Firebase does not currently expose per-call request overrides such as `AbortSignal`; requests are configured via model-level `RequestOptions` only.',
123
123
},
124
+
{
125
+
name: 'ChatSessionBase',
126
+
reason:
127
+
'Base class used by the firebase-js-sdk template chat implementation. RN Firebase exposes its concrete chat session surface instead.',
128
+
},
129
+
{
130
+
name: 'StartTemplateChatParams',
131
+
reason:
132
+
'Template chat startup parameters are part of the firebase-js-sdk template chat API, which RN Firebase does not currently expose.',
133
+
},
134
+
{
135
+
name: 'TemplateChatSession',
136
+
reason:
137
+
'Template chat sessions are not currently part of the RN Firebase public AI API.',
138
+
},
139
+
{
140
+
name: 'TemplateFunctionDeclaration',
141
+
reason:
142
+
'Template function declaration helpers are part of firebase-js-sdk template tooling that RN Firebase does not currently expose.',
143
+
},
144
+
{
145
+
name: 'TemplateFunctionDeclarationsTool',
146
+
reason:
147
+
'Template function declaration tools are part of firebase-js-sdk template tooling that RN Firebase does not currently expose.',
148
+
},
149
+
{
150
+
name: 'TemplateTool',
151
+
reason:
152
+
'Template tool unions are part of firebase-js-sdk template tooling that RN Firebase does not currently expose.',
0 commit comments