mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-25 09:45:04 +02:00
enhance(dev): improve Frontend Bundle Report
This commit is contained in:
9
.github/scripts/frontend-js-size.mjs
vendored
9
.github/scripts/frontend-js-size.mjs
vendored
@@ -530,6 +530,13 @@ function renderFrontendBundleReport(before, after) {
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
function renderVisualizerArtifactLink() {
|
||||
const artifactUrl = process.env.FRONTEND_BUNDLE_REPORT_ARTIFACT_URL;
|
||||
const artifactName = process.env.FRONTEND_BUNDLE_REPORT_ARTIFACT_NAME || 'frontend-bundle-report';
|
||||
const htmlFile = process.env.FRONTEND_BUNDLE_REPORT_HTML_FILE || 'frontend-bundle-visualizer.html';
|
||||
return `> [Bundle visualizer HTML](${artifactUrl}) is included in the ${code(artifactName)} artifact as ${code(htmlFile)}.`;
|
||||
}
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const [beforeDir, afterDir, beforeStatsFile, afterStatsFile, outFile] = args;
|
||||
const before = await collectReport(beforeDir);
|
||||
@@ -547,6 +554,8 @@ const body = [
|
||||
'## Bundle Stats',
|
||||
'',
|
||||
renderFrontendBundleReport(collectVisualizerReport(beforeStats), collectVisualizerReport(afterStats)),
|
||||
'',
|
||||
renderVisualizerArtifactLink(),
|
||||
].join('\n');
|
||||
|
||||
await fs.writeFile(outFile, body);
|
||||
|
||||
Reference in New Issue
Block a user