Skip to content

Commit e53d3ec

Browse files
authored
Merge f54d039 into 86155b3
2 parents 86155b3 + f54d039 commit e53d3ec

File tree

6 files changed

+65
-2
lines changed

6 files changed

+65
-2
lines changed

.changeset/cuddly-apes-check.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/app': minor
3+
'firebase': minor
4+
---
5+
6+
Specify a minimum TypeScript version using the `typesVersions` field. Shows an error message if below.

packages/app-check/test/util.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import {
3535
} from '@firebase/component';
3636
import { AppCheckService } from '../src/factory';
3737
import { AppCheck, CustomProvider } from '../src';
38-
import { HeartbeatService } from '@firebase/app/dist/app/src/types';
3938

4039
export const FAKE_SITE_KEY = 'fake-site-key';
4140

@@ -112,7 +111,7 @@ export function getFakeHeartbeatServiceProvider(
112111
() =>
113112
({
114113
getHeartbeatsHeader: () => Promise.resolve(fakeLogString)
115-
} as HeartbeatService),
114+
} as any),
116115
ComponentType.PRIVATE
117116
)
118117
);

packages/app/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
"browser": "dist/esm/index.esm2017.js",
88
"module": "dist/esm/index.esm2017.js",
99
"react-native": "dist/index.cjs.js",
10+
"typesVersions": {
11+
">=4.5.0": { "*": ["./dist/app/src/index.d.ts"] },
12+
"<4.5.0": { "*": ["./dist/typescript-not-supported.d.ts"] }
13+
},
1014
"exports": {
1115
".": {
1216
"types": "./dist/app-public.d.ts",
@@ -49,6 +53,7 @@
4953
"devDependencies": {
5054
"@rollup/plugin-json": "6.1.0",
5155
"rollup": "2.79.2",
56+
"rollup-plugin-copy": "3.5.0",
5257
"rollup-plugin-replace": "2.2.0",
5358
"rollup-plugin-typescript2": "0.36.0",
5459
"rollup-plugin-dts": "5.3.1",

packages/app/rollup.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18+
import copy from 'rollup-plugin-copy';
1819
import typescriptPlugin from 'rollup-plugin-typescript2';
1920
import replace from 'rollup-plugin-replace';
2021
import typescript from 'typescript';
@@ -53,6 +54,14 @@ const esmBuilds = [
5354
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)),
5455
plugins: [
5556
...buildPlugins,
57+
copy({
58+
targets: [
59+
{
60+
src: './typescript-not-supported.d.ts',
61+
dest: 'dist/'
62+
}
63+
]
64+
}),
5665
replace({
5766
...generateBuildTargetReplaceConfig('esm', 2017),
5867
'__RUNTIME_ENV__': ''
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @license
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
// Empty typings file to log an error message for unsupported TS versions
19+
20+
'Typescript must be version 4.5 or greater.';

scripts/docgen/docgen.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const PREFERRED_PARAMS = [
6565

6666
let authApiReportOriginal: string;
6767
let authApiConfigOriginal: string;
68+
let appPkgOriginal: string;
6869

6970
yargs
7071
.command(
@@ -119,6 +120,14 @@ function cleanup() {
119120
authApiReportOriginal
120121
);
121122
}
123+
// Restore original app/package.json
124+
if (authApiConfigOriginal) {
125+
console.log(`Restoring original app/package.json contents.`);
126+
fs.writeFileSync(
127+
`${projectRoot}/packages/app/package.json`,
128+
appPkgOriginal
129+
);
130+
}
122131
for (const excludedPackage of EXCLUDED_PACKAGES) {
123132
if (fs.existsSync(`${projectRoot}/temp/${excludedPackage}.skip`)) {
124133
console.log(
@@ -198,11 +207,26 @@ async function generateDocs(
198207
`"mainEntryPointFilePath": "<projectFolder>/dist/esm2017/index.doc.d.ts"`
199208
);
200209

210+
console.log(`Temporarily modifying packages/app/package.json for docgen.`);
211+
// Remove typesVersions restriction just for docgen
212+
appPkgOriginal = fs.readFileSync(
213+
`${projectRoot}/packages/app/package.json`,
214+
'utf8'
215+
);
216+
const appPkgModified = appPkgOriginal.replace(
217+
`./dist/typescript-not-supported.d.ts`,
218+
`./dist/app/src/index.d.ts`
219+
);
220+
201221
try {
202222
fs.writeFileSync(
203223
`${projectRoot}/packages/auth/api-extractor.json`,
204224
authApiConfigModified
205225
);
226+
fs.writeFileSync(
227+
`${projectRoot}/packages/app/package.json`,
228+
appPkgModified
229+
);
206230

207231
if (skipBuild) {
208232
await spawn('yarn', ['api-report'], {

0 commit comments

Comments
 (0)