Skip to content

Commit e2b7b25

Browse files
authored
chore(benchmark-size): update current size of credential-provider-ini package (#3299)
* chore(benchmark-size): update logs with benchmarksize script * chore(benchmark-size): update current size of credential-provider-ini package
1 parent 778ad0e commit e2b7b25

File tree

4 files changed

+41
-41
lines changed

4 files changed

+41
-41
lines changed

Diff for: benchmark/size/report.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
|@aws-sdk/credential-provider-cognito-identity|3.49.0|118.3 KB|✅(5.62.1)|✅(2.59.0)|✅(0.13.12)|
3939
|@aws-sdk/credential-provider-env|3.49.0|47.1 KB|N/A|N/A|N/A|
4040
|@aws-sdk/credential-provider-imds|3.49.0|79 KB|N/A|N/A|N/A|
41-
|@aws-sdk/credential-provider-ini|3.49.0|61.4 KB|N/A|N/A|N/A|
41+
|@aws-sdk/credential-provider-ini|3.49.0|69.7 KB|N/A|N/A|N/A|
4242
|@aws-sdk/credential-provider-node|3.49.0|61.5 KB|N/A|N/A|N/A|
4343
|@aws-sdk/credential-provider-process|3.49.0|48.1 KB|N/A|N/A|N/A|
4444
|@aws-sdk/credential-provider-sso|3.49.0|36.3 KB|N/A|N/A|N/A|

Diff for: scripts/benchmark-size/runner/calculate-size/generate-project.ts

-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ export const generateProject = async (projectDir: string, options: PackageSizeRe
1212
...options.packageContext,
1313
dependencies: [...peerDependencies, ...(options.packageContext?.dependencies ?? [])],
1414
};
15-
// console.error("CONTEXT||||||||", contextWithPeerDep);
1615
for (const [name, template] of Object.entries(options.templates)) {
1716
const filePath = join(projectDir, name);
1817
const file = prettier.format(template(contextWithPeerDep), {
1918
filepath: filePath,
2019
});
21-
// console.error("FILE|||||||, ", file);
2220
await fsPromise.writeFile(filePath, file);
2321
}
2422

Diff for: scripts/benchmark-size/runner/calculate-size/index.ts

+35-32
Original file line numberDiff line numberDiff line change
@@ -25,43 +25,46 @@ export interface PackageSizeReportOutput {
2525

2626
export const getPackageSizeReportRunner =
2727
(options: PackageSizeReportOptions) => async (context: ListrContext, task: ListrTaskWrapper<ListrContext, any>) => {
28-
task.output = "preparing...";
29-
const projectDir = join(options.tmpDir, options.packageName.replace("/", "_"));
30-
await fsPromise.rmdir(projectDir, { recursive: true });
31-
await fsPromise.mkdir(projectDir);
32-
const entryPoint = join(projectDir, "index.js");
33-
const bundlersContext = { ...options, entryPoint, projectDir };
28+
try {
29+
task.output = "preparing...";
30+
const projectDir = join(options.tmpDir, options.packageName.replace("/", "_"));
31+
await fsPromise.mkdir(projectDir);
32+
const entryPoint = join(projectDir, "index.js");
33+
const bundlersContext = { ...options, entryPoint, projectDir };
3434

35-
task.output = "generating project and installing dependencies";
36-
await generateProject(projectDir, options);
35+
task.output = "generating project and installing dependencies";
36+
await generateProject(projectDir, options);
3737

38-
task.output = "calculating npm size";
39-
const npmSizeResult = calculateNpmSize(projectDir, options.packageName);
38+
task.output = "calculating npm size";
39+
const npmSizeResult = calculateNpmSize(projectDir, options.packageName);
4040

41-
const skipBundlerTests = bundlersContext.packageContext.skipBundlerTests;
41+
const skipBundlerTests = bundlersContext.packageContext.skipBundlerTests;
4242

43-
task.output = "calculating webpack 5 full bundle size";
44-
const webpackSize = skipBundlerTests ? undefined : await getWebpackSize(bundlersContext);
43+
task.output = "calculating webpack 5 full bundle size";
44+
const webpackSize = skipBundlerTests ? undefined : await getWebpackSize(bundlersContext);
4545

46-
task.output = "calculating rollup full bundle size";
47-
const rollupSize = skipBundlerTests ? undefined : await getRollupSize(bundlersContext);
46+
task.output = "calculating rollup full bundle size";
47+
const rollupSize = skipBundlerTests ? undefined : await getRollupSize(bundlersContext);
4848

49-
task.output = "calculating esbuild full bundle size";
50-
const esbuildSize = skipBundlerTests ? undefined : await getEsbuildSize(bundlersContext);
49+
task.output = "calculating esbuild full bundle size";
50+
const esbuildSize = skipBundlerTests ? undefined : await getEsbuildSize(bundlersContext);
5151

52-
task.output = "output results";
53-
const packageVersion = JSON.parse(
54-
await fsPromise.readFile(
55-
join(options.workspacePackages.filter((pkg) => pkg.name === options.packageName)[0].location, "package.json"),
56-
"utf8"
57-
)
58-
).version;
59-
options.output.push({
60-
name: options.packageName,
61-
version: packageVersion,
62-
...npmSizeResult,
63-
webpackSize,
64-
esbuildSize,
65-
rollupSize,
66-
});
52+
task.output = "output results";
53+
const packageVersion = JSON.parse(
54+
await fsPromise.readFile(
55+
join(options.workspacePackages.filter((pkg) => pkg.name === options.packageName)[0].location, "package.json"),
56+
"utf8"
57+
)
58+
).version;
59+
options.output.push({
60+
name: options.packageName,
61+
version: packageVersion,
62+
...npmSizeResult,
63+
webpackSize,
64+
esbuildSize,
65+
rollupSize,
66+
});
67+
} catch (e) {
68+
e.message = `[${options.packageName}]` + e.message;
69+
}
6770
};

Diff for: scripts/benchmark-size/runner/workspace.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,11 @@ export const validatePackagesAlreadyBuilt = async (packages: WorkspacePackage[])
8787
return true;
8888
};
8989

90-
const notBuilt: string[] = [];
91-
for (const pkg of packages) {
92-
if (!(await isBuilt(pkg.location))) {
93-
notBuilt.push(pkg.name);
94-
}
95-
}
90+
const notBuilt: string[] = await (
91+
await Promise.all(packages.map(async (pkg) => ({ ...pkg, isBuilt: await isBuilt(pkg.location) })))
92+
)
93+
.filter((pkg) => !pkg.isBuilt)
94+
.map((pkg) => pkg.name);
9695
if (notBuilt.length > 0) {
9796
throw new Error(`Please make sure these packages are fully built: ${notBuilt.join(", ")}`);
9897
}

0 commit comments

Comments
 (0)