Skip to content

Commit e96559f

Browse files
XuechunHouFeiyang1
andauthored
Size Analysis Tool - Phase 1 (#3588)
* size analysis tool phase 1 * Create shy-bears-heal.md * Delete shy-bears-heal.md * enable toplevel mangling (#3591) * enforce -o command line flag * ignore size-analysis package in changeset * profile the tests * use smaller timeout * update package.json Co-authored-by: Feiyang <[email protected]> Co-authored-by: Feiyang1 <[email protected]>
1 parent e1d37ef commit e96559f

19 files changed

+2040
-4
lines changed

.changeset/config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
"@firebase/app-types-exp",
1818
"@firebase/functions-exp",
1919
"@firebase/functions-types-exp",
20-
"firebase-exp"
20+
"firebase-exp",
21+
"@firebase/changelog-generator",
22+
"firebase-size-analysis"
2123
],
2224
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
2325
"onlyUpdatePeerDependentsWhenOutOfRange": true,

lerna.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"packages": [
66
"packages/*",
77
"packages-exp/*",
8-
"integration/*"
8+
"integration/*",
9+
"repo-scripts/*"
910
],
1011
"useWorkspaces": true
1112
}

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"size-report": "node scripts/report_binary_size.js",
5050
"api-report": "lerna run --scope @firebase/*-exp api-report",
5151
"docgen:exp": "ts-node-script scripts/exp/docgen.ts",
52-
"postinstall": "yarn --cwd repo-scripts/changelog-generator build"
52+
"postinstall": "yarn --cwd repo-scripts/changelog-generator build",
53+
"sa": "ts-node-script repo-scripts/size-analysis/analysis.ts"
5354
},
5455
"repository": {
5556
"type": "git",
@@ -154,4 +155,4 @@
154155
"pre-commit": "node tools/gitHooks/precommit.js"
155156
}
156157
}
157-
}
158+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @license
3+
* Copyright 2020 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+
module.exports = {
19+
extends: '../../config/.eslintrc.js',
20+
parserOptions: {
21+
project: 'tsconfig.json',
22+
// to make vscode-eslint work with monorepo
23+
// https://github.com/typescript-eslint/typescript-eslint/issues/251#issuecomment-463943250
24+
tsconfigRootDir: __dirname
25+
}
26+
};

repo-scripts/size-analysis/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Modular Export Binary Size Calculator
2+
3+
## Command Line Option
4+
5+
- `--version` Show version number [boolean]
6+
- `--inputModule, --im` The name of the module(s) to be analyzed. example: --inputModule "@firebase/functions-exp" "firebase/auth-exp" [array]
7+
- `--inputDtsFile, --if` Support for adhoc analysis. requires a path to dts file [string]
8+
- `--inputBundleFile, --ib` Support for adhoc analysis. requires a path to a bundle file [string]
9+
- `--output, -o` The location where report(s) will be generated, a directory path if module(s) are analyzed; a file path if ad hoc analysis is to be performed [string]
10+
- `--help ` Show help [boolean]
11+
12+
13+
14+
## Commands To Run The Tool
15+
16+
### Adhoc Support
17+
18+
$firebase-js-sdk/repo-scripts/size-analysis `ts-node-script analysis.ts --if <path to dts file> --ib <path to bundle file> -o <path to output FILE>`
19+
20+
### To Do Analysis On One to Many Firebase Modules
21+
22+
$firebase-js-sdk/repo-scripts/size-analysis `ts-node-script analysis.ts --im "@firebase/module1-exp" "@firebase/module2-exp" -o <path to output DIRECTORY>`
23+
24+
### To Do Analysis On All Firebase-Exp Modules
25+
26+
$firebase-js-sdk/repo-scripts/size-analysis `ts-node-script analysis.ts -o <path to output DIRECTORY>`
27+
28+

0 commit comments

Comments
 (0)