1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-07-25 06:14:50 +02:00

chore(dev): refactor frontend bundle report

This commit is contained in:
syuilo
2026-06-24 15:08:43 +09:00
parent e12f97b1d8
commit 1173550784
2 changed files with 2 additions and 11 deletions

View File

@@ -530,19 +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);
const after = await collectReport(afterDir);
const beforeStats = JSON.parse(await fs.readFile(beforeStatsFile, 'utf8'));
const afterStats = JSON.parse(await fs.readFile(afterStatsFile, 'utf8'));
const visualizerArtifactLink = `> [Bundle visualizer HTML](${process.env.FRONTEND_BUNDLE_REPORT_ARTIFACT_URL}) is included in the ${code('frontend-bundle-visualizer')} artifact as ${code('frontend-bundle-visualizer.html')}.`;
const body = [
marker,
@@ -555,7 +549,7 @@ const body = [
'',
renderFrontendBundleReport(collectVisualizerReport(beforeStats), collectVisualizerReport(afterStats)),
'',
renderVisualizerArtifactLink(),
visualizerArtifactLink,
].join('\n');
await fs.writeFile(outFile, body);