Skip to content

refactor: migrate build system to tsdown and dist output directory#136

Merged
agoldis merged 2 commits into
mainfrom
feat/improve-build
May 19, 2026
Merged

refactor: migrate build system to tsdown and dist output directory#136
agoldis merged 2 commits into
mainfrom
feat/improve-build

Conversation

@agoldis
Copy link
Copy Markdown
Contributor

@agoldis agoldis commented May 19, 2026

Summary

  • Replaces the previous tsc + write-cjs-package-json.mjs build pipeline with tsdown, outputting to dist/ instead of build/
  • Updates all entry points, scripts, Dockerfile, CI workflows, and documentation to reference the new dist/ paths
  • Adds server version and logo metadata to the MCP server configuration
  • Allows releases from release/* branches in addition to main
  • Bumps to v2.3.0

Changes breakdown

Build tooling

  • Introduced tsdown.config.ts as the new bundler config producing dist/api.mjs, dist/api.cjs, and dist/index.mjs
  • Removed tsconfig.cjs.json and scripts/write-cjs-package-json.mjs (no longer needed)
  • Replaced rimraf dev dependency with tsdown

Package configuration (package.json)

  • Updated bin, main, module, types, exports to point at dist/
  • Updated build, clean, prepublishOnly scripts to use tsdown
  • Removed audit production dependency

Dockerfile

  • Build stage now copies tsdown.config.ts + assets/ instead of old scripts
  • Runtime stage copies dist/ and assets/; entry point changed to dist/index.mjs
  • Build stage upgraded to node:24-alpine

Server (src/server.ts)

  • Reads version from package.json at build time
  • Embeds base64-encoded logo from assets/logo.png
  • Passes serverInfo with version and logo to the MCP server constructor

Tests & fixtures

  • Integration tests updated to reference dist/ paths
  • Consumer fixtures (consumer-cjs.cjs, consumer-cjs-dynamic-import.cjs, consumer-esm.mjs) updated import paths

CI & docs

  • dependabot-review.yml updated boot-check path
  • CONTRIBUTE.md updated local testing instructions
  • .release-it.json now allows release/* branches

Review hints

  • Start with tsdown.config.ts and package.json to understand the new build shape
  • Verify exports map covers all consumption patterns (ESM, CJS require, CJS dynamic import)
  • Check Dockerfile layer order makes sense for caching
  • The server.ts changes are mostly additive (version + logo injection)

Made with Cursor

Summary by CodeRabbit

  • Chores
    • Migrated build output and package entrypoints from build/ to dist/, updated runtime entrypoint and Docker runtime image.
    • Switched build tooling to tsdown and adjusted packaging/publish scripts.
  • Documentation
    • Updated developer and contribution docs, config examples, and test fixtures to reference the new distribution layout.

Review Change Stack

…tions

- Changed build output from `build/` to `dist/` across various files, including Dockerfile, package.json, and integration tests.
- Updated entry points and scripts to reflect the new output structure.
- Removed obsolete CommonJS configuration and introduced `tsdown` for building.
- Added logo asset and updated server configuration to include versioning and logo data.
- Adjusted test fixtures to align with the new module paths.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 74cf26d3-5db8-48f3-b1be-312921a973fd

📥 Commits

Reviewing files that changed from the base of the PR and between 0962df8 and 5b4a31c.

📒 Files selected for processing (1)
  • mcp-server/vitest.config.ts

📝 Walkthrough

Walkthrough

The PR migrates the MCP server build system from separate TypeScript configurations outputting to build/ to a unified tsdown configuration outputting to dist/. All runtime references, test fixtures, CI workflows, and documentation are updated to use the new artifact paths. The MCP server implementation gains build-provided metadata injection for logos and versioning.

Changes

Build System Migration to tsdown with dist Output

Layer / File(s) Summary
Build configuration and entrypoint setup
mcp-server/tsdown.config.ts, mcp-server/package.json
New tsdown configuration replaces tsconfig.cjs.json and consolidates ESM/CJS output to dist/ with base64-encoded logo and version injected as compile-time constants. package.json bin, main, module, types, and exports paths are updated to reference dist/ artifacts; build/start/cleanup scripts and dev deps updated accordingly.
Artifact path updates in Docker and test configuration
Dockerfile, mcp-server/.gitignore, mcp-server/vitest.config.ts, .github/workflows/dependabot-review.yml
Dockerfile build stage upgrades to node:24-alpine, copies tsdown.config.ts and assets, and runtime stage copies /app/dist and starts dist/index.mjs. .gitignore now ignores dist/. Vitest config removes build from test and coverage exclusions. Dependabot-check workflow runs node dist/index.mjs --help in its execution check.
Documentation and local dev examples
CONTRIBUTE.md, mcp-server/scripts/sync-readme-tools.mjs
Local development instructions and inline tooling comments updated to reference ./mcp-server/dist/index.mjs and the new built output location.
Test fixtures and integration test paths
mcp-server/src/cli-bin.integration.test.ts, mcp-server/src/package-environments.integration.test.ts, mcp-server/src/package-published-esm.integration.test.ts, mcp-server/test/fixtures/consumer-*.{mjs,cjs}
Integration test prerequisites, fixture imports, and documentation updated to check for and import from dist/api.mjs (ESM) and dist/api.cjs (CJS) instead of build/ artifacts.
MCP server metadata and tool registration
mcp-server/src/server.ts
Tool import statements reorganized; server.registerTool(...) calls standardized to pass *.handler. Server initialization reads injected __LOGO_BASE64__ and __VERSION__ to populate icons (PNG data URI) and version in the McpServer options.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • miguelangaranocurrents
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: migrating the build system from tsc to tsdown and changing the output directory from build/ to dist/.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/improve-build

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

Copy link
Copy Markdown

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@mcp-server/src/server.ts`:
- Around line 47-62: The file dereferences build-injected globals
__LOGO_BASE64__ and __VERSION__ directly (used to set logoBase64 and version for
the McpServer) which throws ReferenceError in test environments; guard these by
checking typeof __LOGO_BASE64__ and typeof __VERSION__ and provide safe
fallbacks (e.g. empty string or a default version) before constructing the
McpServer options so tests can import src/server.ts without CI failures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9096d716-96c3-484b-bd65-dfd4a82e5b1d

📥 Commits

Reviewing files that changed from the base of the PR and between b1be9de and 0962df8.

⛔ Files ignored due to path filters (2)
  • mcp-server/assets/logo.png is excluded by !**/*.png
  • mcp-server/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (17)
  • .github/workflows/dependabot-review.yml
  • CONTRIBUTE.md
  • Dockerfile
  • mcp-server/.gitignore
  • mcp-server/package.json
  • mcp-server/scripts/sync-readme-tools.mjs
  • mcp-server/scripts/write-cjs-package-json.mjs
  • mcp-server/src/cli-bin.integration.test.ts
  • mcp-server/src/package-environments.integration.test.ts
  • mcp-server/src/package-published-esm.integration.test.ts
  • mcp-server/src/server.ts
  • mcp-server/test/fixtures/consumer-cjs-dynamic-import.cjs
  • mcp-server/test/fixtures/consumer-cjs.cjs
  • mcp-server/test/fixtures/consumer-esm.mjs
  • mcp-server/tsconfig.cjs.json
  • mcp-server/tsdown.config.ts
  • mcp-server/vitest.config.ts
💤 Files with no reviewable changes (2)
  • mcp-server/scripts/write-cjs-package-json.mjs
  • mcp-server/tsconfig.cjs.json

Comment thread mcp-server/src/server.ts
The tsdown build injects these globals via `define`, but Vitest runs
source directly and was missing them, causing server.test.ts to fail.

Co-authored-by: Cursor <cursoragent@cursor.com>
@agoldis agoldis merged commit 9e6b84c into main May 19, 2026
5 checks passed
@agoldis agoldis deleted the feat/improve-build branch May 19, 2026 01:08
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.

1 participant