Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for yarn@berry #4568

Closed
rault-a opened this issue May 15, 2024 · 12 comments
Closed

Support for yarn@berry #4568

rault-a opened this issue May 15, 2024 · 12 comments
Assignees
Labels
Type: Question Needs clarification

Comments

@rault-a
Copy link
Contributor

rault-a commented May 15, 2024

Package version

6.9.0

Describe the bug

Hello 馃憢馃徎

When adding a package with node ace add, it throw an error and crashes when using yarn berry (yarn v2, v3 or v4).

In @antfu/install-pkg, when using yarn berry, it returns yarn@berry instead of yarn but @adonisjs/core checks that the package manager is yarn, npm or pnpm. Just adding yarn@berry to the list of supported package managers in commands/add.ts:48 fixes the issue.

Also, @antfu/install-pkg can return pnpm@6 for older version of pnpm, or bun for bun, but I did not test those.

I can do a PR for this issue if you want, at least for yarn@berry, not sure the support for bun or the older versions of pnpm is something that we want.

Reproduction repo

No response

@Julien-R44
Copy link
Member

Julien-R44 commented May 15, 2024

I'm not at all familiar with Yarn Berry. Does Adonis work with Yarn Berry? Have you been able to try?
There are also potentially other places to modify to support yarn berry:

As I was saying, I think nobody in the team is super familiar with yarn berry. So this is an initiative that someone in the community should lead

About older version of pnpm and bun, I would say no. AdonisJS still doesnt work with Bun, so its kind of pointless. And older versions of pnpm were released before AdonisJS 6.

@thetutlage
Copy link
Member

Yeah. I think our goal is to support npm and pnpm (latest) versions. Yarn had massive changes with every version and we are not even aware of what all those changes are. Bun is also very much in experimental state.

Infact, we recently updated our docs to just mention npm commands for the same reason.

I will close this issue for now.

@thetutlage thetutlage added the Type: Question Needs clarification label May 16, 2024
@thetutlage thetutlage self-assigned this May 16, 2024
@rault-a
Copy link
Contributor Author

rault-a commented May 16, 2024

For the record if needed, I have indeed been able to try by patching locally adonis and it works perfecly once the support for yarn berry is added.
Also, yarn did not have massive change since yarn 2 that came out 4 years ago.
Wouldn't it be a good idea to allow people to use it even with no guarantee of support?

@RomainLanz
Copy link
Member

I agree with @rault-a. We should not stop people trying to use Yarn Berry or Bun to install dependencies.

It seems to be an easy fix that will help people that already know what they are doing.

@Julien-R44
Copy link
Member

Yeah same. If we are sure that Adonis works correctly with these packages manager and that it only requires a few lines to be changed, then I don't see any reason to not support it

Especially as Yarn has a huge number of users, more than pnpm if I am not wrong. Not supporting it would cut us off from a large part of the community

@RomainLanz RomainLanz reopened this May 17, 2024
@rault-a
Copy link
Contributor Author

rault-a commented May 18, 2024

Hello, I quickly check the other places mentioned by @Julien-R44 (because I did not had any issue between node ace add with yarn berry and patching the line I mentioned alone allowed me to make it work).

It seems those places (codemod and bundler) fallback on npm when encountering a non supported package manager (ignoring the yarn.lock in case of the bundler), so there is indeed a bit more work to be done than expected, but still minimal.

For the create-adonisjs, I do not think it is a major issue however: yarn berry is installed by project, not globally, so if yarn v1 is supported, it should be enough, the user can easily migrate to yarn berry after the installation (but another improvement could be to automatically use yarn berry in this case during installation).

Still open to make the PR if needed, at least for the node ace add, codemod and bundler, the update of create-adonisjs seems like a more major change.

@Julien-R44
Copy link
Member

Yup, happy to accept a PR for that! Thanks

@thetutlage
Copy link
Member

Can this we closed since the PR has been merged?

@RomainLanz
Copy link
Member

Yes!

@Julien-R44
Copy link
Member

We are still missing updates for the bundler, codemods and create-adonisjs

@rault-a do you plan to create a PR for this ?

@rault-a
Copy link
Contributor Author

rault-a commented May 22, 2024

Yes, but I am waiting for the release of the assembler, required to update the core (otherwise, there is a typing issue)

@Julien-R44
Copy link
Member

Done https://github.com/adonisjs/assembler/releases/tag/v7.6.1

@rault-a rault-a mentioned this issue May 23, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Question Needs clarification
Projects
None yet
Development

No branches or pull requests

4 participants