Skip to content
Draft

bun #4737

Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
917 changes: 917 additions & 0 deletions .claude/docs/plans/yarn-to-bun-migration-plan.md

Large diffs are not rendered by default.

33 changes: 15 additions & 18 deletions .cursor/rules/tech-stack.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Plate is a modern, extensible rich-text editor framework for React built as a so

- **Frontend**: React 19.1.0, Next.js 15.3.3, TypeScript 5.8.3
- **Styling**: Tailwind CSS 4.1.8, Radix UI, shadcn/ui patterns
- **Build**: Yarn workspaces, Turbo, tsup
- **Build**: Bun workspaces, Turbo, tsup
- **Testing**: Jest, Playwright, Testing Library
- **Deployment**: Vercel with automatic deployments
- **Distribution**: npm packages under @platejs scope
Expand All @@ -32,7 +32,7 @@ Plate is a modern, extensible rich-text editor framework for React built as a so
### Node.js Runtime

- **Required Version**: >= 18.12.0
- **Package Manager**: Yarn 4.6.0 (using Plug'n'Play with node-modules linker)
- **Package Manager**: Bun 1.3.2
- **Engine Enforcement**: Strict engine checking enabled

### Language Features
Expand Down Expand Up @@ -159,12 +159,9 @@ export async function POST(req: Request) {

### Package Manager

```yaml
# .yarnrc.yml configuration
nodeLinker: node-modules
enableGlobalCache: false
enableTelemetry: false
```
- **Bun**: 1.3.2 for fast package management
- Configuration via `package.json` packageManager field
- No additional configuration files needed

### Code Quality Tools

Expand All @@ -189,13 +186,13 @@ enableTelemetry: false

### Type Checking

**Important**: Before running `yarn typecheck`, you must first run `yarn install --frozen-lockfile`, then `yarn build` to ensure all packages are built and type definitions are available.
**Important**: Before running `bun run typecheck`, you must first run `bun install --frozen-lockfile`, then `bun run build` to ensure all packages are built and type definitions are available.

```bash
# Required sequence for type checking
yarn install --frozen-lockfile # Install all dependencies and update lockfile if needed
yarn build # Build all packages (generates type definitions)
yarn typecheck # Check all packages
bun install --frozen-lockfile # Install all dependencies
bun run build # Build all packages (generates type definitions)
bun run typecheck # Check all packages
```

### Testing Strategy
Expand All @@ -222,14 +219,14 @@ yarn typecheck # Check all packages

```bash
# Required sequence for development
yarn install --frozen-lockfile # Install dependencies and update lockfile if needed
yarn build # Build all packages first
yarn typecheck # Type checking (requires built packages)
bun install --frozen-lockfile # Install dependencies
bun run build # Build all packages first
bun run typecheck # Type checking (requires built packages)

# Other development commands
yarn dev # Start development server
yarn test # Run tests
yarn lint # Run ESLint
bun run dev # Start development server
bun run test # Run tests
bun run lint # Run Biome linter
```

These are root commands, but if you modified just a few packages, it's more efficient to run those commands in the modified packages.
Expand Down
124 changes: 0 additions & 124 deletions .github/actions/yarn-nm-install/action.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/claude-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:

Please analyze the changes in this PR/issue and create or update the relevant tests accordingly.
**Important Development Sequence:**
- Before running type checking, you must first run `yarn install` and build affected packages
- Use `yarn turbo build --filter=./packages/modified-package` to build only modified packages and their dependencies
- Use `yarn turbo typecheck --filter=./packages/modified-package` for type checking modified packages
- Use `yarn turbo lint:fix --filter=./packages/modified-package` for linting modified packages.
- Avoid full project commands (`yarn build`, `yarn typecheck`, `yarn lint:fix`), these are very slow
- Before running type checking, you must first run `bun install` and build affected packages
- Use `bun turbo build --filter=./packages/modified-package` to build only modified packages and their dependencies
- Use `bun turbo typecheck --filter=./packages/modified-package` for type checking modified packages
- Use `bun turbo lint:fix --filter=./packages/modified-package` for linting modified packages.
- Avoid full project commands (`bun run build`, `bun typecheck`, `bun lint:fix`), these are very slow
16 changes: 8 additions & 8 deletions .github/workflows/claude.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ jobs:
- Documentation
- Changeset required when updating packages
- Updating `docs/components/changelog.mdx` is required only when updating `apps/www/src/registry`
- (only once) Run `yarn install`, then build only modified packages with their dependencies
- (only once) Run `bun install`, then build only modified packages with their dependencies
- Validate your package changes efficiently using turbo filtering for modified packages
**Important Development Sequence:**
- Before running type checking, you must first run `yarn install` and build affected packages
- Use `yarn turbo build --filter=./packages/modified-package` to build only modified packages and their dependencies
- Use `yarn turbo typecheck --filter=./packages/modified-package` for type checking modified packages
- Use `yarn turbo lint:fix --filter=./packages/modified-package` for linting modified packages
- For multiple packages: `yarn turbo build --filter=./packages/core --filter=./packages/utils`
- Always end development work with `yarn turbo lint:fix --filter=./packages/modified-package` to auto-fix linting issues
- Avoid full project commands (`yarn build`, `yarn typecheck`, `yarn lint:fix`), these are very slow
- Before running type checking, you must first run `bun install` and build affected packages
- Use `bun turbo build --filter=./packages/modified-package` to build only modified packages and their dependencies
- Use `bun turbo typecheck --filter=./packages/modified-package` for type checking modified packages
- Use `bun turbo lint:fix --filter=./packages/modified-package` for linting modified packages
- For multiple packages: `bun turbo build --filter=./packages/core --filter=./packages/utils`
- Always end development work with `bun turbo lint:fix --filter=./packages/modified-package` to auto-fix linting issues
- Avoid full project commands (`bun run build`, `bun typecheck`, `bun lint:fix`), these are very slow
40 changes: 26 additions & 14 deletions .github/workflows/lint-typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ on:
- 'packages/**'
- '.github/actions/**'
- '.github/workflows/lint-typecheck.yml'
- '.yarnrc.yml'
- 'yarn.lock'
- 'bun.lock'
- 'biome.jsonc'
- 'eslint*'
- 'jest.config.js'
Expand All @@ -28,8 +27,7 @@ on:
- 'packages/**'
- '.github/actions/**'
- '.github/workflows/**'
- '.yarnrc.yml'
- 'yarn.lock'
- 'bun.lock'
- 'biome.jsonc'
- 'eslint*'
- 'jest.config.js'
Expand All @@ -52,40 +50,54 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: 📥 Monorepo install
uses: ./.github/actions/yarn-nm-install
- name: ♻️ Setup bun cache
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

- name: 📥 Install dependencies
run: bun install --frozen-lockfile

- name: 🔬 Lint
run: yarn check
run: bun check

- name: ♻️ Restore packages cache
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.cache
${{ github.workspace }}/**/tsconfig.tsbuildinfo
key: packages-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
key: packages-cache-${{ runner.os }}-${{ hashFiles('bun.lock') }}

- name: 🏗 Build
run: yarn build
run: bun run build

- name: 🕵️ Typecheck + 🧪 Test (parallel)
run: yarn verify
run: bun run verify

# - name: 📥 Install Playwright dependencies
# run: |
# yarn playwright install-deps
# yarn playwright install
# bun playwright install-deps
# bun playwright install

# - name: 🎭 Run Playwright tests
# run: yarn e2e
# run: bun e2e

notify-failure:
name: Discord Notification
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,37 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: 📥 Monorepo install
uses: ./.github/actions/yarn-nm-install
- name: ♻️ Setup bun cache
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

- name: 📥 Install dependencies
run: bun install --frozen-lockfile

- name: ♻️ Restore packages cache
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.cache
${{ github.workspace }}/**/tsconfig.tsbuildinfo
key: packages-cache-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
key: packages-cache-${{ runner.os }}-${{ hashFiles('bun.lock') }}

- name: 🏗 Build Registry
run: yarn r && yarn build:tw
run: bun run r && bun run build:tw

- name: ◻️ Create Pull Request
uses: peter-evans/create-pull-request@v4
Expand Down
19 changes: 16 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,26 @@ jobs:
# To run comparison we need more than the latest commit
fetch-depth: 0

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: ♻️ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: 📦 Monorepo install
uses: ./.github/actions/yarn-nm-install
- name: ♻️ Setup bun cache
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

- name: 📦 Install dependencies
run: bun install --frozen-lockfile

# @link https://github.com/changesets/action
- name: 🦋 Create Release Pull Request or Publish
Expand All @@ -33,7 +46,7 @@ jobs:
with:
cwd: ${{ github.workspace }}
title: '[Release] Version packages'
publish: yarn release
publish: bun release
env:
# See https://github.com/changesets/action/issues/147
HOME: ${{ github.workspace }}
Expand Down
Loading
Loading