Skip to content

build: add codecov plugin to tsdown#37

Merged
snipsnipsnip merged 4 commits intoexteditor:mainfrom
snipsnipsnip:more-codecov
Oct 9, 2025
Merged

build: add codecov plugin to tsdown#37
snipsnipsnip merged 4 commits intoexteditor:mainfrom
snipsnipsnip:more-codecov

Conversation

@snipsnipsnip
Copy link
Copy Markdown
Member

@snipsnipsnip snipsnipsnip commented Oct 9, 2025

Codecov can also keep track of bundle sizes and test results for us. Let's enable them.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 9, 2025

📝 Walkthrough

Summary by CodeRabbit

  • Documentation

    • Expanded build documentation and clarified bundling overview.
    • Updated README with a Services section featuring status, review, coverage, and bundle-size badges.
  • Tests

    • Added JUnit test reporting alongside existing reporters.
  • Chores

    • Integrated Codecov to upload coverage and test results in CI.
    • Configured coverage paths via a new Codecov configuration.
    • Enabled bundle-size reporting during release builds.
    • Added a development dependency to support coverage integration.
    • Minor test report filename adjustment for consistency.

Walkthrough

Adds Codecov bundle-size reporting: new tools/codecov.ts provides a conditional rollup plugin loader; tools/tsdown_config.ts invokes it for release ESM/IIFE bundles; CI workflows, docs, README, and package devDependencies updated to enable Codecov uploads and badges.

Changes

Cohort / File(s) Summary
Documentation
doc/building.md
Expanded build docs: describes tsdown_config.ts, tsdown overview, adds codecov node and codecovio consumer to the build graph, and documents tools/codecov.ts (release-only upload behavior).
Codecov helper
tools/codecov.ts
New module exporting CodecovOptions and async codecov(...): returns [] if no bundleName or missing CODECOV_TOKEN; lazily imports @codecov/rollup-plugin and returns configured plugin(s) with bundle analysis.
tsdown configuration
tools/tsdown_config.ts
Imports codecov and conditionally appends isRelease && codecov({ env, bundleName: "background" }) to ESM plugins and isRelease && codecov({ env, bundleName: "compose" }) to IIFE plugins.
CI workflows
.github/workflows/build.yml, .github/workflows/check-pr.yml
Test steps add junit reporter alongside github-actions; added Codecov coverage and test-results upload steps (gated by not-cancelled); removed redundant coverage upload step in build workflow.
Package metadata
package.json
Adds devDependency @codecov/rollup-plugin@^1.9.1.
Codecov config & tests
.github/codecov.yml, tools/vitest_config.ts
Adds Codecov configuration (project/patch path globs) and changes Vitest junit output filename to result.junit.xml.
Repository docs
README.md
Reworked badges: removed some previous badges, added a Services section with GitHub Actions, CodeRabbit-reviewed, Codecov coverage, and two Codecov bundle-size badges (esm, iife).

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)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • ci: install codecov #36 — also adds Codecov integration and updates CI workflows (.github/workflows/*) to upload Codecov artifacts.

Poem

I nibble bytes beneath the moon,
A tiny token hums its tune,
On release hops I send a thread,
Bundle sizes counted, neatly fed.
Badges gleam and builds well-tuned. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description is too brief and does not follow the repository’s required template sections such as the dual-license agreement, type of change, current and new behavior, or testing instructions, leaving essential context and validation steps unspecified. Please revise the description to use the provided template by adding the license agreement checkbox, selecting the change type, describing both the current and new behavior, and including steps to verify the changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “build: add codecov plugin to tsdown” succinctly and accurately captures the primary change of integrating a Codecov plugin into the tsdown build configuration without unnecessary detail.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9742eeb and 3efa898.

📒 Files selected for processing (2)
  • .github/codecov.yml (1 hunks)
  • README.md (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/codecov.yml

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 9, 2025

Codecov Report

❌ Patch coverage is 5.55556% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.47%. Comparing base (7a456b6) to head (3efa898).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
tools/codecov.ts 8.33% 11 Missing ⚠️
tools/tsdown_config.ts 0.00% 5 Missing ⚠️
tools/vitest_config.ts 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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: Use const for immutable binding.

The imported plugin is never reassigned, so use const instead of let.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7a456b6 and 7ea1578.

⛔ Files ignored due to path filters (1)
  • yarn.lock is 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 using codecov() 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
codecovRollupPlugin is the named export in v1.9.1 and supports enableBundleAnalysis, bundleName, and uploadToken.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 74be070 and b6f457f.

📒 Files selected for processing (2)
  • .github/workflows/build.yml (2 hunks)
  • .github/workflows/check-pr.yml (1 hunks)

@snipsnipsnip snipsnipsnip added this pull request to the merge queue Oct 9, 2025
Merged via the queue into exteditor:main with commit 1e22f79 Oct 9, 2025
4 checks passed
@snipsnipsnip snipsnipsnip deleted the more-codecov branch October 9, 2025 08:51
@github-project-automation github-project-automation bot moved this from 📥️Inbox to 🪺Experimental in Ghostbird Issues Oct 9, 2025
@snipsnipsnip snipsnipsnip moved this from 🪺Experimental to ✅Closed in Ghostbird Issues Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant