build: add codecov plugin to tsdown#37
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds Codecov bundle-size reporting: new Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Developer
participant CI as CI / Local Build
participant Cfg as tools/tsdown_config
participant Helper as tools/codecov
participant Plugin as @codecov/rollup-plugin
participant Codecov as codecov.io
Dev->>CI: trigger release build (isRelease, env)
CI->>Cfg: load build configs
Cfg->>Helper: codecov({ bundleName, env })
alt isRelease && CODECOV_TOKEN present
Helper->>Plugin: dynamic import & configure (enableBundleAnalysis, bundleName, uploadToken)
Plugin->>Codecov: upload bundle analysis
Codecov-->>Plugin: ack
Plugin-->>Cfg: return plugin instance
else non-release or missing token
Helper-->>Cfg: return []
Note right of Cfg #f3f4f6: Codecov plugin omitted
end
Cfg-->>CI: resolved plugins
CI-->>Dev: build completes (with/without Codecov upload)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #37 +/- ##
==========================================
- Coverage 48.81% 48.47% -0.35%
==========================================
Files 54 55 +1
Lines 2116 2133 +17
Branches 285 286 +1
==========================================
+ Hits 1033 1034 +1
- Misses 1076 1092 +16
Partials 7 7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
tools/tsdown_config.ts (1)
116-119: Same async handling concern as Line 104.The same potential issue with
Promise<Plugin[]>applies here.See the review comment on Line 104 for details.
🧹 Nitpick comments (1)
tools/codecov.ts (1)
17-17: Useconstfor immutable binding.The imported plugin is never reassigned, so use
constinstead oflet.Apply this diff:
- let { codecovRollupPlugin } = await import("@codecov/rollup-plugin") + const { codecovRollupPlugin } = await import("@codecov/rollup-plugin")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (4)
doc/building.md(3 hunks)package.json(1 hunks)tools/codecov.ts(1 hunks)tools/tsdown_config.ts(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tools/tsdown_config.ts (1)
tools/codecov.ts (1)
codecov(11-24)
🔇 Additional comments (7)
tools/tsdown_config.ts (2)
29-29: LGTM!The import is correctly placed and follows the existing pattern.
104-104: No changes needed for async plugins
tsdown/Rolldown accepts and awaits Promise<Plugin[]> in its plugins array, so usingcodecov()here is correct.doc/building.md (3)
3-5: LGTM!The updated description accurately reflects the tooling and provides helpful context.
27-35: LGTM!The mermaid diagram correctly incorporates the codecov step in the build flow.
87-88: LGTM!The documentation clearly explains when and why the codecov plugin runs.
package.json (1)
72-72: No updates needed for @codecov/rollup-plugin
Current version 1.9.1 is the latest and has no known security advisories.tools/codecov.ts (1)
17-23: Verified correct plugin export and API
codecovRollupPluginis the named export in v1.9.1 and supportsenableBundleAnalysis,bundleName, anduploadToken.
9e4bed1 to
fc2688c
Compare
fc2688c to
de76e46
Compare
de76e46 to
9742eeb
Compare
9742eeb to
3efa898
Compare
Codecov can also keep track of bundle sizes and test results for us. Let's enable them.