Skip to content

optimize: collapse the details info#23

Merged
yifancong merged 11 commits intomainfrom
feat/support-collapsed
Dec 18, 2025
Merged

optimize: collapse the details info#23
yifancong merged 11 commits intomainfrom
feat/support-collapsed

Conversation

@yifancong
Copy link
Copy Markdown
Contributor

@yifancong yifancong commented Dec 17, 2025

optimize: collapse the details info

Copilot AI review requested due to automatic review settings December 17, 2025 13:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for collapsible sections in bundle analysis reports and implements a fallback mechanism to find baseline artifacts from parent commits when the latest commit lacks them. The changes improve the user experience by automatically expanding reports with significant changes while keeping minor changes collapsed, and by providing clearer feedback when baseline comparisons use fallback commits.

Key Changes

  • Exports formatBytes and calculateDiff utility functions for reuse across modules
  • Implements fallback logic to search up to 5 parent commits when the latest commit doesn't have baseline artifacts
  • Adds collapsible Quick Summary and Detailed Reports sections in PR comments, with automatic expansion based on change significance

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/report.ts Exports utility functions (formatBytes, calculateDiff) and changes 'N/A' to '0' for missing baseline comparisons; removes emoji for changes < 1%
src/github.ts Adds hasArtifactsForCommit and getParentCommit methods; modifies getTargetBranchLatestCommit to return object with fallback information and traverse up to 5 parent commits
src/index.ts Adds fallback tracking fields to ProjectReport; implements collapsible sections with conditional expansion based on change significance (>= 1%); adds Quick Summary table for monorepo overview
src/tests/github.test.ts Updates test to expect object return type from getTargetBranchLatestCommit; adds test case for fallback commit behavior when latest commit has no artifacts
dist/index.js Compiled output reflecting source changes, including new methods and collapsible section logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/index.ts
Comment thread src/report.ts
Comment thread src/index.ts Outdated
Comment thread src/github.ts
@yifancong yifancong force-pushed the feat/support-collapsed branch from 4310ddc to 45dda4e Compare December 17, 2025 13:24
@yifancong yifancong changed the title Feat/support collapsed Optimize: collapse the useless info Dec 17, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 17, 2025

Rsdoctor Bundle Diff Analysis

Found 2 projects in monorepo, 1 project with changes.

📊 Quick Summary
Project Total Size Change
rsbuild-demo 190.4 KB 0
rsbuild-demo2 190.9 KB +189.0 B (0.1%)
📋 Detailed Reports (Click to expand)

📁 rsbuild-demo2

Path: examples/rsbuild-demo2/dist/.rsdoctor/rsdoctor-data.json

📌 Baseline Commit: 4e57a095c4 | PR: #22

Metric Current Baseline Change
📊 Total Size 190.9 KB 190.7 KB +189.0 B (0.1%)
📄 JavaScript 189.0 KB 188.8 KB +189.0 B (0.1%)
🎨 CSS 345.0 B 345.0 B 0
🌐 HTML 374.0 B 374.0 B 0
📁 Other Assets 1.2 KB 1.2 KB 0

📦 Download Diff Report: rsbuild-demo2 Bundle Diff

Generated by Rsdoctor GitHub Action

@yifancong yifancong force-pushed the feat/support-collapsed branch from c698191 to 5b550d6 Compare December 18, 2025 11:49
@yifancong yifancong changed the title Optimize: collapse the useless info Optimize: collapse the details info Dec 18, 2025
@yifancong yifancong changed the title Optimize: collapse the details info optimize: collapse the details info Dec 18, 2025
@yifancong yifancong merged commit 5b30d99 into main Dec 18, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants