Skip to content

Replace Yarn Berry by PNPM #2932

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

Merged
merged 1 commit into from
Jul 21, 2025
Merged

Replace Yarn Berry by PNPM #2932

merged 1 commit into from
Jul 21, 2025

Conversation

Kocal
Copy link
Member

@Kocal Kocal commented Jul 20, 2025

Q A
Bug fix? no
New feature? no
Docs? no
Issues Fix #...
License MIT

Purely internal, this PR replaces Yarn by PNPM for the following reasons:

For developers working on UX, pnpm can be installed with Corepack

Note: the ~26k lines changed are mainly about lock files

@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label Jul 20, 2025
Copy link
Contributor

github-actions bot commented Jul 20, 2025

📊 Packages dist files size difference

Thanks for the PR! Here is the difference in size of the packages dist files between the base branch and the PR.
Please review the changes and make sure they are expected.

FileBefore (Size / Gzip)After (Size / Gzip)
Autocomplete
controller.js 17.6 kB / 4.12 kB 17.61 kB0% / 4.13 kB0%

- name: Replace local "workspace:*" occurrences
run: |
yarn workspaces foreach -pA exec "sed -i 's/\"workspace:\*\"/\"${{ env.VERSION }}\"/g' package.json"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is automatically done when running pnpm publish, see https://pnpm.io/workspaces#publishing-workspace-packages

@Kocal Kocal force-pushed the move-from-yarn-to-pnpm branch 7 times, most recently from 1eef72b to 548ae06 Compare July 21, 2025 06:59
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/user-event": "^14.6.1",
"@testing-library/dom": "catalog:",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catalogs are like an alias to a constraint version.
When defining the catalog version for @testing-library/dom, then it will always install the exact same version when installing the same package in different places (if we use the same catalog ofc)

Comment on lines +52 to +60
"@testing-library/dom": "catalog:",
"@testing-library/jest-dom": "catalog:",
"@testing-library/user-event": "catalog:",
"jsdom": "catalog:",
"tom-select": "^2.2.2",
"tslib": "catalog:",
"tsx": "catalog:",
"typescript": "catalog:",
"vitest": "catalog:",
Copy link
Member Author

@Kocal Kocal Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the (dev) dependencies used by the package instead of relying of packages installed from parents directories (that "magically" works with Yarn) is a good practice.

By using catalog:, we will have the same exact version of the dependency installed everywhere (consistency).

@@ -7,6 +7,8 @@
* file that was distributed with this source code.
*/

/// <reference types="@types/webpack-env" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise __WebpackModuleApi was not found

@@ -7,6 +7,8 @@
* file that was distributed with this source code.
*/

/// <reference types="google.maps" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise google type was not found

@Kocal Kocal force-pushed the move-from-yarn-to-pnpm branch from 548ae06 to d25f4cb Compare July 21, 2025 07:07
@Kocal Kocal force-pushed the move-from-yarn-to-pnpm branch from d25f4cb to 17a4bb7 Compare July 21, 2025 08:06
YARN_ENABLE_HARDENED_MODE: 0
YARN_ENABLE_IMMUTABLE_INSTALLS: 0
- working-directory: test_apps/encore-app
run: pnpm install --ignore-workspace
Copy link
Member Author

@Kocal Kocal Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--ignore-workspace allows to ignore the pnpm-workspace.yaml from parent folders, and install dependencies from test_apps/encore-app only (test_apps/encore-app is not a workspace on purpose)

@Kocal Kocal requested review from kbond and smnandre July 21, 2025 08:21
@smnandre
Copy link
Member

What does it mean for the contributors?

@smnandre
Copy link
Member

Nice job and i’m all in to leave legacy yarn :)

@Kocal
Copy link
Member Author

Kocal commented Jul 21, 2025

What does it mean for the contributors?

pnpm will be automatically installed when running corepack enable, which we already explain in our CONTRIBUTING.md. And of course, commands like yarn install or yarn build won't work anymore, in favor of pnpm install, pnpm build, etc...

Copy link
Member

@kbond kbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good arguments for this change!

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Jul 21, 2025
@Kocal Kocal merged commit b096ecc into symfony:2.x Jul 21, 2025
31 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants