Skip to content

Conversation

@ibrahimcesar
Copy link
Owner

No description provided.

Implements automated bundle size tracking with GitHub Actions badges
displaying real-time JavaScript and CSS file sizes.

## Changes

### New Workflow
- **size-badges.yml**: Automated workflow that:
  - Builds project on push to main and PRs
  - Calculates raw and gzipped sizes for all bundle files
  - Generates color-coded badges based on size limits
  - Commits badge updates to main branch automatically
  - Creates detailed size reports in workflow summary

### Badge Files (5 total)
- size-es.json: ES Module gzipped size (10KB limit)
- size-cjs.json: CommonJS gzipped size (10KB limit)
- size-css.json: CSS gzipped size (2KB limit)
- size-js.json: Combined JS size (raw + gzipped)
- size-total.json: Total bundle size (JS + CSS)

### README Updates
- Added 3 new bundle size badges:
  - ES Module (gzip)
  - CommonJS (gzip)
  - CSS (gzip)
- Badges positioned with package metrics for visibility
- All badges link to size-badges workflow

### Documentation
- **SIZE_BADGES.md**: Comprehensive guide covering:
  - How the badge system works
  - Badge file structure and formats
  - Size limits and color coding
  - Pull request workflow
  - Troubleshooting guide
  - Maintenance best practices

## Features

- **Automatic Updates**: Badges update on every push to main
- **Color Coding**: Visual indicators for size thresholds
  - Bright Green (≤70%): Excellent
  - Green (71-85%): Good
  - Yellow (86-95%): Warning
  - Orange (96-100%): Near limit
  - Red (>100%): Over limit
- **PR Integration**: Size reports in PR workflow summaries
- **Manual Trigger**: Can manually run workflow when needed

## Benefits

- **Transparency**: Users see bundle sizes at a glance
- **Performance Monitoring**: Track size increases over time
- **PR Reviews**: Size impact visible before merging
- **Accountability**: Automatic alerts when limits exceeded

Follows same pattern as existing coverage badge system.
Changed badge colors from dynamic to fixed colors:
- JavaScript badge: yellow
- Total size badge: red
- CSS badge: blue

Updated workflow to generate badges with new static colors.
ES Module and CommonJS badges still use dynamic colors pending
color selection.
@ibrahimcesar ibrahimcesar merged commit e9e1240 into main Nov 15, 2025
6 of 7 checks passed
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
ES Module 2.99 KB (0%)
CommonJS 2.96 KB (0%)
CSS 1.05 KB (0%)

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.

3 participants