plate icon indicating copy to clipboard operation
plate copied to clipboard

bun

Open zbeyens opened this issue 1 month ago • 5 comments

Summary

Complete migration from Yarn 4.6.0 to Bun 1.3.2 as the package manager for the Plate monorepo.

Key Changes

  • Package Manager: Upgraded from Yarn 4.6.0 to Bun 1.3.2
  • Lockfile: Replaced yarn.lock with bun.lock (6,023 entries)
  • Configuration: Removed Yarn-specific files (.yarnrc.yml, .yarn/ directory)
  • Scripts: Updated all package.json scripts to use bun commands
  • CI/CD: Created new bun-install GitHub Action and updated all workflows
  • Documentation: Updated CLAUDE.md, tech stack documentation, and README

Files Changed

Removed:

  • .yarnrc.yml
  • yarn.lock (22,275 lines)
  • .yarn/plugins/ and .yarn/releases/
  • .github/actions/yarn-nm-install/

Created:

  • bun.lock (6,023 entries)
  • .github/actions/bun-install/action.yml
  • .claude/docs/plans/yarn-to-bun-migration-plan.md
  • ZOD_ISSUE.md (documenting known issue)

Modified:

  • Root package.json (packageManager, engines, all scripts)
  • All 51 package package.json files
  • All GitHub workflow files (.github/workflows/*.yml)
  • CLAUDE.md (command documentation)
  • .cursor/rules/tech-stack.mdc

Benefits

  • Faster Installation: Bun's native speed improvements
  • Faster Execution: Built-in task runner performance
  • Simpler Configuration: No custom Yarn plugins needed
  • Better Monorepo Support: Native workspace support

Verification

  • ✅ All packages build successfully
  • ✅ Type checking passes
  • ✅ Linting passes
  • ✅ All tests pass (2,233 tests, 32 snapshots)
  • ✅ CI/CD workflows updated and validated

Breaking Changes

For Contributors:

  • Must install Bun 1.3.2 or later
  • Replace all yarn commands with bun
  • Replace npx with bunx

For CI/CD:

  • GitHub workflows now use oven-sh/setup-bun@v2 action
  • Cache keys updated to use bun.lock

Migration Commands

# Old (Yarn)
yarn install
yarn build
yarn test
yarn workspace @platejs/core build

# New (Bun)
bun install
bun build
bun test
bun workspace @platejs/core build

Test Plan

  • [x] Clean install: rm -rf node_modules && bun install
  • [x] Build all packages: bun build
  • [x] Type check: bun typecheck
  • [x] Run linting: bun check
  • [x] Run tests: bun test
  • [x] Verify CI workflows syntax
  • [x] Test individual package operations

Known Issues

  • Zod Version Issue: There's a known peer dependency warning with Zod (documented in ZOD_ISSUE.md)
    • Not blocking for this migration
    • Can be addressed in a follow-up PR

Rollback Plan

If issues arise:

  1. Revert the commit: git revert ae6271b1e
  2. Restore Yarn: yarn install (will recreate yarn.lock)
  3. Rebuild: yarn build

References

  • Migration plan: .claude/docs/plans/yarn-to-bun-migration-plan.md
  • Bun Documentation: https://bun.sh/docs
  • Setup Bun Action: https://github.com/oven-sh/setup-bun

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

zbeyens avatar Nov 20 '25 20:11 zbeyens

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders
Open Preview

codesandbox[bot] avatar Nov 20 '25 20:11 codesandbox[bot]

⚠️ No Changeset found

Latest commit: a8748f9cd67dc9a06d8ba20ae9a205a40def4d09

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Nov 20 '25 20:11 changeset-bot[bot]

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
plate Error Error Nov 21, 2025 11:43am

vercel[bot] avatar Nov 20 '25 20:11 vercel[bot]

bun + turbopack does not work here. will go for pnpm in the meantime.

zbeyens avatar Nov 21 '25 15:11 zbeyens

pnpm: same issue with turbopack

## Error Type
Runtime ReferenceError

## Error Message
int is not defined


    at module evaluation (src/registry/components/editor/use-chat.ts:5:76)
    at module evaluation (src/registry/components/editor/plugins/ai-kit.tsx:17:1)
    at module evaluation (src/registry/components/editor/editor-kit.tsx:6:41)
    at module evaluation (src/registry/examples/playground-demo.tsx:11:68)
    at module evaluation (src/components/playground-preview.tsx:11:65)
    at IndexPage (src/app/(app)/page.tsx:119:13)

## Code Frame
  3 | import * as React from 'react';
  4 |
> 5 | import { type UseChatHelpers, useChat as useBaseChat } from '@ai-sdk/react';
    |                                                                            ^
  6 | import { faker } from '@faker-js/faker';
  7 | import { AIChatPlugin, aiCommentToRange } from '@platejs/ai/react';
  8 | import { getCommentKey, getTransientCommentKey } from '@platejs/comment';

Next.js version: 16.0.3 (Turbopack)

zbeyens avatar Nov 21 '25 16:11 zbeyens