-
Notifications
You must be signed in to change notification settings - Fork 6
Add size-limit for small libraries with GitHub Actions #297
Copy link
Copy link
Closed
Labels
@arkenv/vite-pluginIssues or Pull Requests involving the Vite plugin for ArkEnvIssues or Pull Requests involving the Vite plugin for ArkEnvarkenvChanges to the `arkenv` npm package.Changes to the `arkenv` npm package.github actionsPull requests that update GitHub Actions codePull requests that update GitHub Actions codeinfraInfrastructure related issue or pull requestInfrastructure related issue or pull request
Description
Metadata
Metadata
Assignees
Labels
@arkenv/vite-pluginIssues or Pull Requests involving the Vite plugin for ArkEnvIssues or Pull Requests involving the Vite plugin for ArkEnvarkenvChanges to the `arkenv` npm package.Changes to the `arkenv` npm package.github actionsPull requests that update GitHub Actions codePull requests that update GitHub Actions codeinfraInfrastructure related issue or pull requestInfrastructure related issue or pull request
📋 Summary
Add size-limit to track and enforce bundle size limits for the
arkenvpackage. This will help prevent bundle size regressions and maintain the library's small footprint.📊 Current Bundle Sizes
Based on gzipped sizes of the current build:
dist/index.js): 2,015 bytes (1.97 KB)dist/index.cjs): 2,446 bytes (2.39 KB)🎯 Proposed Limits
Set limits to current size + 1KB:
dist/index.js): 3,039 bytes (≈ 3.0 KB)dist/index.cjs): 3,470 bytes (≈ 3.4 KB)🔧 Implementation Steps
1. Install Dependencies
Add size-limit and the preset for small libraries:
2. Configure size-limit
Add size-limit configuration to
packages/arkenv/package.json:{ "size-limit": [ { "path": "dist/index.js", "limit": "3.0 KB" }, { "path": "dist/index.cjs", "limit": "3.4 KB" } ] }3. Add size Script
Add the size script to
packages/arkenv/package.json:{ "scripts": { "size": "size-limit" } }4. Create GitHub Actions Workflow
Create
.github/workflows/size-limit.yml:5. Update Test Suite (Optional)
Consider adding size check to the test suite:
{ "scripts": { "test": "vitest && pnpm run size" } }📚 References
✅ Acceptance Criteria
🎨 Additional Notes
@size-limit/preset-small-libusesesbuildandfileplugins, which is perfect for small libraries