honojs / middleware

monorepo for Hono third-party middleware/helpers/wrappers
https://hono.dev
420 stars 144 forks source link

Use Bun as package manager #628

Open gunta opened 2 months ago

gunta commented 2 months ago

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.

yusukebe commented 2 months ago

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?

nakasyou commented 2 months ago

@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.

yusukebe commented 2 months ago

@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.

nakasyou commented 2 months ago

Update Hono version:

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

yusukebe commented 2 months ago

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.

nakasyou commented 2 months ago

@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

yusukebe commented 2 months ago

@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 commented 2 months ago

@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?

nakasyou commented 2 months ago

Hi @yusukebe, thank you for your proposal.

Yes, it is nice idea!

yusukebe commented 2 months ago

@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.