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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch package manager from yarn to pnpm #1662

Closed
wants to merge 4 commits into from

Conversation

flevi29
Copy link
Collaborator

@flevi29 flevi29 commented May 24, 2024

Pull Request

Related issue

Fixes #1660

What does this PR do?

  • Switches package manager to pnpm
  • Migrates all lockfiles from yarn.lock to pnpm-lock.yaml
  • Makes usage of corepack, so that installing pnpm becomes trivial
  • Adds packageManager entry to package.json

@flevi29 flevi29 added the enhancement New feature or request label May 24, 2024
@flevi29 flevi29 requested a review from brunoocasali May 24, 2024 07:39
@flevi29 flevi29 marked this pull request as draft May 24, 2024 07:39
@flevi29
Copy link
Collaborator Author

flevi29 commented May 24, 2024

How do these work, how can I see what is hidden in this action, what does cache do here exactly?

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'

I need to know this, it might need adjustments.

EDIT: I'm guessing it sets up yarn if it's not already cached, and maybe something else. This requires changes. All it has to do is corepack enable instead of installing yarn.

image

EDIT: I thought this might require changes in instant-meilisearch as well as that uses actions/setup-node@v4 too, but by default corepack will install the latest version of Yarn 1.x as soon as you type yarn in the command line and there isn't any packageManager specified in the package.json of that repository.

@brunoocasali
Copy link
Member

Hi @flevi29, although I see the pnpm is faster than yarn, I don't think we should move away from the current package manager because we have yarn set up in the other js apps/libs across the org. Changing that to a different one will be a pain 😅.

@flevi29
Copy link
Collaborator Author

flevi29 commented May 27, 2024

Okay, fair enough. However my suggestion would make it so that nothing would have to be changed in all the other repositories.

Corepack lets you use Yarn, npm, and pnpm without having to install them. (https://github.com/nodejs/corepack)

We could adopt corepack, and manage package manager versions via the "packageManager" entry instead of globally.

  • This would enable us to use whatever package manager we want in whatever JS repository, and for instance, adopt a new one like pnpm gradually, painlessly, if we so desire
  • It's co-authored by Yarn, they even recommend it, and it's even the way they tell you to install the latest Yarn versions; read here more: https://yarnpkg.com/corepack and https://yarnpkg.com/getting-started/install
  • If you don't want pnpm that's completely fine, but then let's upgrade yarn, we're still using 1.x, which is only a maintenance version, and to upgrade yarn we should absolutely adopt corepack

@flevi29
Copy link
Collaborator Author

flevi29 commented May 29, 2024

Closing as not planned.

@flevi29 flevi29 closed this May 29, 2024
@flevi29 flevi29 deleted the switch-to-pnpm branch May 29, 2024 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch package manager to pnpm
2 participants