Skip to content

Commit a46d695

Browse files
committed
refine tsdoc
1 parent b1057f6 commit a46d695

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

repo-scripts/size-analysis/analyze-all-bundles.ts

+15-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ import { Report } from '../../scripts/size_report/report_binary_size';
3838
*
3939
* More details on how a test bundle is built can be found in `bundle-analysis.ts`.
4040
*
41-
* @param {string} [version] - If present, the SDK version to run measurement against
42-
* @returns {Promise<Report[]>} A list of bundle size measurements
41+
* @param version - If present, the SDK version to run measurement against
42+
* @returns A list of bundle size measurements
4343
*/
44-
export async function generateReportForBundles(version?: string) {
44+
export async function generateReportForBundles(version?: string): Promise<Report[]> {
4545
const definitionDir = `${__dirname}/bundle-definitions`;
4646
const outputDir = tmp.dirSync().name;
4747
console.log(`Bundle definitions are located at "${definitionDir}".`);
@@ -95,7 +95,18 @@ function parseAnalysisOutput(product: string, output: string) {
9595
const analyses = JSON.parse(fs.readFileSync(output, { encoding: 'utf-8' }));
9696
const results: Report[] = [];
9797
for (const analysis of analyses) {
98-
const sdk = 'bundle';
98+
// The API of the backend for persisting size measurements currently requires data to be
99+
// organized strictly in the below json format:
100+
//
101+
// {
102+
// sdk: <some-string>,
103+
// type: <some-string>,
104+
// value: <some-integer>
105+
// }
106+
//
107+
// We are reusing this API here, although its semantics does not make sense in the context of
108+
// bundle-analysis.
109+
const sdk = 'bundle'; // to accommodate above API syntax, can be any string
99110
const value = analysis.results[0].size;
100111
const type = `${product} (${analysis.name})`;
101112
results.push({ sdk, type, value });

0 commit comments

Comments
 (0)