Skip to content

Comments

feat: migrate to bun#443

Merged
nizzyabi merged 1 commit intostagingfrom
feat/migrate-to-bun
Mar 14, 2025
Merged

feat: migrate to bun#443
nizzyabi merged 1 commit intostagingfrom
feat/migrate-to-bun

Conversation

@nizzyabi
Copy link
Collaborator

@nizzyabi nizzyabi commented Mar 14, 2025

Migrating to bun


Type of Change

Please delete options that are not relevant.

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature with breaking changes)
  • 📝 Documentation update
  • 🎨 UI/UX improvement
  • 🔒 Security enhancement
  • ⚡ Performance improvement

Areas Affected

Please check all that apply:

  • Email Integration (Gmail, IMAP, etc.)
  • User Interface/Experience
  • Authentication/Authorization
  • Data Storage/Management
  • API Endpoints
  • Documentation
  • Testing Infrastructure
  • Development Workflow
  • Deployment/Infrastructure

Testing Done

Describe the tests you've done:

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • Cross-browser testing (if UI changes)
  • Mobile responsiveness verified (if UI changes)

Security Considerations

For changes involving data or authentication:

  • No sensitive data is exposed
  • Authentication checks are in place
  • Input validation is implemented
  • Rate limiting is considered (if applicable)

Checklist

  • I have read the CONTRIBUTING document
  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in complex areas
  • I have updated the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix/feature works
  • All tests pass locally
  • Any dependent changes are merged and published

Additional Notes

Add any other context about the pull request here.

Screenshots/Recordings

Add screenshots or recordings here if applicable.


By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.

Summary by CodeRabbit

  • New Features

    • Introduced a new workspace configuration to support multi-package management.
    • Added a dedicated lint task for improved code quality.
  • Documentation

    • Updated contributing guidelines and setup instructions with new commands and prerequisites reflecting the shift to Bun.
  • Chores

    • Transitioned package management and development commands from the previous toolset to Bun.
    • Revised ignore settings to accommodate new debug log conventions.
    • Removed outdated workspace configurations to streamline the development environment.

@vercel
Copy link

vercel bot commented Mar 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
0 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 14, 2025 6:09pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 14, 2025

Walkthrough

The changes update the project’s toolchain from using Node.js with pnpm to using Bun across various areas. The Dockerfile now installs Bun globally instead of yarn and pnpm, and corresponding documentation (CONTRIBUTING.md, README.md) and CI configurations have been updated accordingly. Linting commands, ignored files, and lock file references have also been modified, and a new workspace configuration is introduced in the Bun configuration file. Additionally, the legacy pnpm workspace file has been removed.

Changes

File(s) Change Summary
.devcontainer/Dockerfile Replaced global installation of yarn pnpm with bun via npm.
.github/CONTRIBUTING.md, README.md Updated documentation: restructured Table of Contents (in CONTRIBUTING.md) and replaced references and commands for Node.js/pnpm with Bun.
.github/workflows/ci.yaml Modified CI workflow to remove Node.js/pnpm setup and added steps to set up Bun (with bun-version: "latest") and run Bun commands for installation and formatting.
.gitignore, apps/mail/.gitignore Added entries (bun-debug.log* / +bun-debug.log*) to ignore Bun debug log files.
.husky/pre-commit Updated pre-commit hook to replace pnpm lint-staged with bun lint-staged.
.prettierignore Replaced ignored lock file by removing pnpm-lock.yaml and adding bun.lockb.
bunfig.toml Added a new [install] section with a workspaces key set to ["apps/*", "packages/*"] to manage the monorepo structure.
package.json Updated the packageManager field to "bun@1.2.5", revised scripts (lint, check, db commands) to use Bun instead of pnpm, and added a workspaces field with the appropriate paths.
pnpm-workspace.yaml Deleted the file, thereby removing the prior pnpm workspace configuration.
turbo.json Added a new "lint" task under the tasks object with an empty "outputs": [] array.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant CI as CI Pipeline
    participant Bun as Bun Runtime

    Dev->>CI: Push commit
    CI->>Bun: Set up environment (install, format, etc.)
    Bun-->>CI: Execute commands using Bun
    CI->>Dev: Report build and test results
Loading

Poem

I'm hopping through the code all day,
With Bun to lead me on my way.
Commands and scripts now take a leap,
In Docker and CI, they run so neat.
A bunny's joy in every line—hop on, let's code away!

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
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

🧹 Nitpick comments (5)
turbo.json (1)

28-33: Addition of Lint Task for Turbo: The new "lint" task with an empty "outputs": [] prepares the project for running linting via Turbo (as indicated by the turbo run lint command in package.json).
Consider verifying if any linting artifacts should be declared under "outputs" for caching purposes, or if an empty array is sufficient for your workflow.

.devcontainer/Dockerfile (1)

47-47: Redundant Bun installation detected.

Bun is already being installed via the official installer on line 32. Installing it again via npm is redundant and could potentially lead to version conflicts. Consider removing this line if you're already using the official Bun installation method.

- npm install -g bun
+ # Bun already installed via curl on line 32

Additionally, if the project is completely migrating to Bun, evaluate whether Node.js and npm are still needed in the development environment.

.github/workflows/ci.yaml (1)

28-28: Consider pinning Bun to a specific version for CI reproducibility.

Using latest for the Bun version in CI can lead to unexpected failures if new Bun versions introduce breaking changes. For better reproducibility and stability in your CI pipeline, consider pinning to a specific version.

- bun-version: latest
+ bun-version: 1.0.21  # or whatever version you're currently using

However, if staying on the cutting edge of Bun features is important for your project, using latest is a valid approach.

.github/CONTRIBUTING.md (1)

29-36: Successfully updated setup instructions for Bun.

The development environment setup instructions have been correctly updated to use Bun instead of Node.js/pnpm.

Consider adding a brief note explaining the migration from pnpm to Bun and its benefits, which would provide helpful context for contributors familiar with the previous setup.

README.md (1)

213-213: Grammar Improvement Suggestion
The sentence beginning on this line would benefit from a punctuation adjustment. Consider adding a comma after “...push the schemas to the database,” for better readability. For example:

"To be able to run bun db:push and push the schemas to the database, you also have to add a .env file to the packages/db folder with the following content:"

🧰 Tools
🪛 LanguageTool

[uncategorized] ~213-~213: Possible missing comma found.
Context: ...un db:pushand push the schemas to the database you also have to add a.env` file to t...

(AI_HYDRA_LEO_MISSING_COMMA)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f73d8ab and c58301c.

⛔ Files ignored due to path filters (2)
  • bun.lock is excluded by !**/*.lock
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (12)
  • .devcontainer/Dockerfile (1 hunks)
  • .github/CONTRIBUTING.md (4 hunks)
  • .github/workflows/ci.yaml (1 hunks)
  • .gitignore (1 hunks)
  • .husky/pre-commit (1 hunks)
  • .prettierignore (1 hunks)
  • README.md (7 hunks)
  • apps/mail/.gitignore (1 hunks)
  • bunfig.toml (1 hunks)
  • package.json (2 hunks)
  • pnpm-workspace.yaml (0 hunks)
  • turbo.json (1 hunks)
💤 Files with no reviewable changes (1)
  • pnpm-workspace.yaml
🧰 Additional context used
🪛 LanguageTool
README.md

[uncategorized] ~213-~213: Possible missing comma found.
Context: ...un db:pushand push the schemas to the database you also have to add a.env` file to t...

(AI_HYDRA_LEO_MISSING_COMMA)

🔇 Additional comments (28)
.prettierignore (1)

1-1: Lockfile Ignore Update: Removing pnpm-lock.yaml and adding bun.lockb correctly reflects the switch to Bun as the package manager.

bunfig.toml (1)

1-3: New Bun Configuration: The addition of the [install] section with a workspaces key set to [ "apps/*", "packages/*" ] is well-aligned with the migration to Bun and helps manage the monorepo structure.

apps/mail/.gitignore (1)

32-32: Bun Debug Log Ignored: Adding bun-debug.log* ensures that debug logs generated by Bun are not tracked in Git. This change is appropriate and consistent with the overall migration effort.

.gitignore (1)

34-34: Updated Git Ignore for Bun Logs: The new entry bun-debug.log* in the global .gitignore correctly prevents Bun debug logs from being committed.

.husky/pre-commit (1)

1-1: Change looks good! Successfully migrated pre-commit hook to use Bun.

The pre-commit hook now correctly uses Bun instead of pnpm to run lint-staged, which aligns with the project's migration to the Bun runtime.

.devcontainer/Dockerfile (1)

31-36: LGTM! Proper Bun installation and PATH configuration.

The official Bun installation method is correctly used and the PATH is properly configured in both .bashrc and .zshrc files.

.github/workflows/ci.yaml (2)

25-28: Successfully migrated CI workflow to use Bun!

The workflow now correctly uses the official oven-sh/setup-bun@v1 action to set up the Bun environment for CI.


30-34: Commands properly updated to use Bun.

The commands for installing dependencies and running format checks have been correctly updated to use Bun instead of pnpm.

.github/CONTRIBUTING.md (2)

7-20: Great improvement to the Table of Contents!

The reorganized and expanded Table of Contents provides better navigation and structure for the contributing guide.


40-47: All commands consistently updated to use Bun.

The development workflow and database management commands have been correctly and consistently updated to use Bun instead of pnpm throughout the document.

Also applies to: 70-71, 117-130

README.md (9)

45-45: Update Required Version Information
The dependency section now correctly requires Bun (v1.0 or higher) instead of pnpm. This aligns with the migration to Bun.


67-67: Update Dependency Installation Command
The command has been updated to use bun install instead of the previous package manager command. This change is consistent with the migration objective.


70-70: Update Database Dependency Command
Replaced the old command with bun db:dependencies to install database dependencies. This update is correct for ensuring consistency with Bun.


73-73: Update Docker Startup Command
The command to start the Docker environment has been updated to bun docker:up. This fits the new toolchain requirements.


83-84: Update Environment Setup Commands for Database
Commands under the environment setup section are updated:

  • bun db:dependencies is used to install database dependencies.
  • bun db:push is now used to push schemas to the database.
    These modifications ensure that the setup instructions match the Bun runtime.

89-89: Update Application Start Command
The start command has been changed to bun dev, replacing the old package manager command. This change is appropriate for the migration process.


121-122: Update Dev Container Commands
Within the Dev Container setup instructions, the commands are updated to remove bun.lockb and then reinstall dependencies using bun install. This helps prevent issues related to outdated lock files and matches the Bun workflow.


231-231: Update Database Startup Command
The command to start the local PostgreSQL instance has been updated to bun docker:up. This change correctly reflects the new runtime toolchain.


255-275: Update Database Commands
The database-related commands have been uniformly updated:

  • Line 255: Uses bun db:dependencies to install dependencies.
  • Line 260: Uses bun db:push for setting up database tables.
  • Line 265: Uses bun db:generate to create migration files.
  • Line 270: Uses bun db:migrate to apply migrations.
  • Line 275: Uses bun db:studio to view database content.

These updates ensure all database commands are consistent with the Bun runtime migration.

package.json (9)

5-5: Update Package Manager Field
The packageManager field has been updated to "bun@1.2.5", replacing the previous pnpm configuration. This is correct based on the current migration efforts.


10-10: Update Lint Command
The lint command has been changed from "next lint" to "turbo run lint" to reflect the new tooling and improve consistency with the project’s build system.


12-12: Update Check Command
The check command now uses Bun ("bun run check:format && bun run lint"), which is consistent with the overall migration objectives.


19-19: Update Database Dependencies Script
The command for setting up database dependencies is now "cd packages/db && bun install", ensuring consistency with the Bun runtime migration.


20-20: Update Database Generate Script
The script for generating database files is updated to use Bun via "cd packages/db && bun run db:generate". This aligns with the new development environment.


21-21: Update Database Migrate Script
The database migration script has been updated to "cd packages/db && bun run db:migrate". This change is appropriate for the migration to Bun.


22-22: Update Database Push Script
The push command for database schemas has been changed to "cd packages/db && bun run db:push", in line with other Bun command updates.


23-23: Update Database Studio Script
The command to view the database content is now "cd packages/db && bun run db:studio". This completes the update of database commands to Bun standards.


35-38: Add Workspaces Field
The new "workspaces": ["apps/*", "packages/*"] field is added, which helps in organizing the project structure. This addition is beneficial for maintaining a clean monorepo setup.

@nizzyabi nizzyabi merged commit 8b139d8 into staging Mar 14, 2025
4 checks passed
@BlankParticle BlankParticle deleted the feat/migrate-to-bun branch May 25, 2025 13:43
@coderabbitai coderabbitai bot mentioned this pull request May 28, 2025
9 tasks
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