Skip to content

Commit dbf51a9

Browse files
committed
fix binary size report
1 parent 201a364 commit dbf51a9

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

packages/messaging/sw/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@firebase/messaging",
2+
"name": "@firebase/messaging-sw",
33
"description": "",
44
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
55
"module": "../dist/index.sw.esm2017.js",

scripts/size_report/report_binary_size.ts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,21 @@ function generateReportForCDNScripts(): Report[] {
4545
const reports = [];
4646
const firebaseRoot = path.resolve(__dirname, '../../packages/firebase');
4747
const pkgJson = require(`${firebaseRoot}/package.json`);
48+
const compatPkgJson = require(`${firebaseRoot}/compat/package.json`);
4849

4950
const special_files = [
50-
'firebase-performance-standalone.es2017.js',
51-
'firebase-performance-standalone.js',
52-
'firebase-firestore.memory.js',
53-
'firebase.js'
51+
'firebase-performance-standalone-compat.es2017.js',
52+
'firebase-performance-standalone-compat.js',
53+
'firebase-compat.js'
5454
];
5555

5656
const files = [
5757
...special_files.map((file: string) => `${firebaseRoot}/${file}`),
5858
...pkgJson.components.map(
59-
(component: string) => `${firebaseRoot}/firebase-${component}.js`
59+
(component: string) => `${firebaseRoot}/firebase-${component.replace('/', '-')}.js`
60+
),
61+
...compatPkgJson.components.map(
62+
(component: string) => `${firebaseRoot}/firebase-${component}-compat.js`
6063
)
6164
];
6265

@@ -77,7 +80,16 @@ async function generateReportForNPMPackages(): Promise<Report[]> {
7780
for (const info of packageInfo) {
7881
const packages = await findAllPackages(info.location);
7982
for (const pkg of packages) {
80-
reports.push(...(await collectBinarySize(pkg)));
83+
try {
84+
reports.push(...(await collectBinarySize(pkg)));
85+
} catch (e) {
86+
// log errors and continue to the next package
87+
console.log(
88+
`failed to generate report for ${pkg}.
89+
error: ${e}`
90+
);
91+
}
92+
8193
}
8294
}
8395
return reports;
@@ -104,11 +116,12 @@ async function collectBinarySize(pkg: string): Promise<Report[]> {
104116
const fields = [
105117
'main',
106118
'module',
107-
'esm2017',
108119
'browser',
120+
'esm5',
109121
'react-native',
122+
'cordova',
110123
'lite',
111-
'lite-esm2017'
124+
'lite-esm5'
112125
];
113126
const json = require(pkg);
114127
for (const field of fields) {

0 commit comments

Comments
 (0)