Skip to content

chore: use bun #1093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed

chore: use bun #1093

wants to merge 6 commits into from

Conversation

nakasyou
Copy link
Contributor

@nakasyou nakasyou commented Apr 1, 2025

This PR switches the package manager used in this project to Bun.

Why migrate to Bun?

One reason for migrating is the faster installation speed, but that’s not the primary motivation. The main benefit of using Bun is that it helps save disk space. Yarn creates a node_modules directory for every workspace, even when packages share the same version. In contrast, Bun typically creates a node_modules directory only at the project root, significantly reducing disk space usage.

Addressing Version Mismatch Issues

There were issues where Bun caused version mismatches, leading to test failures.

These failing tests have been resolved in this PR. Most test failures stemmed from type mismatches. For example, the current version of Hono includes a TypeScript property, status, to improve user experience, which didn’t exist in older versions. Adding such TypeScript properties caused issues when test code in this project used Equal, as shown below:

type Actual = ExtractSchema<typeof route>
type Expected = {
  '/': {
    $post: {
      input: {}
      output: {}
    }
  }
}
type verify = Expect<Equals<Actual, Expected>>

In this PR, the issue is resolved by using expectTypeOf<Actual>().toMatchObjectType<Expected>(). This approach doesn’t require exact equality, only compatibility between types.

Additionally, with Bun, you can specify a particular version of Hono in devDependencies. If a different Hono version is listed in devDependencies, Bun creates a separate node_modules directory to maintain compatibility.

The Author Should Do the Following, if Applicable

  • Add tests
  • Run tests
  • Run yarn changeset at the root of this repo and push the changeset
  • Follow the contribution guide

Copy link

changeset-bot bot commented Apr 1, 2025

⚠️ No Changeset found

Latest commit: 53dfda6

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

@nakasyou nakasyou marked this pull request as draft April 1, 2025 06:13
@nakasyou
Copy link
Contributor Author

nakasyou commented Apr 1, 2025

Duplicate #628

@nakasyou nakasyou closed this Apr 1, 2025
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