middleware icon indicating copy to clipboard operation
middleware copied to clipboard

Use Bun as package manager

Open gunta opened this issue 1 year ago • 12 comments

Currently Hono is using Bun as package manager, but the Middleware is not. https://github.com/honojs/hono/commit/ead367760180437610639637c0eeefe1e5789c9f

For consistency and easiness of contribution, it might be a good idea to use Bun here too.

gunta avatar Jul 09 '24 08:07 gunta

Hi @gunta, good suggestion.

Actually, @nakasyou created the PR for the same purpose: https://github.com/honojs/middleware/pull/561

@nakasyou Can you make it ready for review?

yusukebe avatar Jul 10 '24 01:07 yusukebe

@yusukebe With Yarn, each package generates a node_modules that follows the lockfile, including the same version of Hono as when it was first installed. (This consumes a lot of storage.)

In Bun, dependencies are consolidated as much as possible if they are compatible according to each package's package.json.

Therefore, packages tested with a certain version of Hono in Yarn may fail tests in Bun, as the version becomes the latest one within the range specified in package.json.

There are two solutions:

  1. Fix the version dependency on Hono for the problematic packages.
  2. Update the problematic packages to be compatible with the latest Hono.

I have been working on solution 2, I made some packages a success, but it is difficult for me as I am not familiar with each package.

On the other hand, solution 1 would clearly mean no longer supporting the latest Hono.

nakasyou avatar Jul 10 '24 01:07 nakasyou

@nakasyou Thank you for your comment and investigation.

Hmmm. I also think the ideal is 2 - following the last hono. However, I want to increase the maintenance cost for this middleware project.

yusukebe avatar Jul 13 '24 09:07 yusukebe

Update Hono version:

  • [ ] arktype-validator
  • [ ] auth-js
  • [ ] bun-transpiler (#661)
  • [ ] clerk-auth (#661)
  • [ ] effect-validator (#661)
  • [ ] esbuild-transpiler (#661)
  • [ ] ~~eslint-config~~
  • [ ] event-emitter (#661)
  • [ ] firebase-auth
  • [ ] graphql-server (#661)
  • [ ] ~~hello~~
  • [ ] medley-router (#661)
  • [ ] node-ws (#661)
  • [ ] oauth-providers (#662)
  • [ ] oidc-auth
  • [ ] prometheus (#661)
  • [ ] qwik-city (#661)
  • [ ] react-compat (#661)
  • [ ] react-renderer (#661)
  • [ ] sentry (#661)
  • [ ] swagger-ui (#661)
  • [ ] trpc-server (#661)
  • [ ] typebox-validator
  • [ ] typia-validator
  • [ ] valibot-validator (#663)
  • [ ] zod-openapi (#661)
  • [ ] zod-validator (#661)

Most failed package can't respond to Hono's type change and an error is occurring.

nakasyou avatar Jul 22 '24 01:07 nakasyou

Hi @nakasyou

Thank you for working on it!

I have a quick question. Does using Bun as a package manager mean all middleware packages should work on the same version of hono within the honojs/middleware project? It's ideal for all packages to follow the latest hono, but I think it's a little hard in the real world. If some test fails by updating hono unintendedly, the maintainer (almost I) should fix the code or test. It will be a big pressure for me. Not all middleware authors are active. For example, some will not respond to my pinging.

yusukebe avatar Jul 22 '24 01:07 yusukebe

@yusukebe I didn't understand this well, so I tried it. Then, answer is no. The version is not necessarily common. Probably only if there is compatibility between packages. This is based on Semantic Versioning.

The problem some package in hono/middleware having is that the package doesn't match the max version indicated in package.json.

https://github.com/nakasyou/bun-monorepo-deps-test

nakasyou avatar Jul 22 '24 01:07 nakasyou

@nakasyou

Thank you very much!

I too, tried your repo. I think it's no problem going with your plan. Regarding semantic versioning, as you said, there are incompatible Types(we have to work hard for them!). But basically, we don't add a breaking change if not a major update.

Let's go with it. Sorry for taking your time!

yusukebe avatar Jul 22 '24 02:07 yusukebe

@nakasyou

I think it would be good to create a branch like bun-pm for these changes and merge PRs to the branch. And all will be done, merge it into the main. What about it?

yusukebe avatar Jul 22 '24 05:07 yusukebe

Hi @yusukebe, thank you for your proposal.

Yes, it is nice idea!

nakasyou avatar Jul 22 '24 09:07 nakasyou

@nakasyou

Created the branch: https://github.com/honojs/middleware/tree/bun-pm

Base your PRs on that branch. If everything is finished, I'll merge it into the main.

yusukebe avatar Jul 22 '24 10:07 yusukebe

@nakasyou Any update on this? :)

gunta avatar Dec 29 '24 20:12 gunta

Could you check this? https://github.com/honojs/middleware/pull/661

nakasyou avatar Dec 30 '24 00:12 nakasyou