Skip to content

Commit d25f4cb

Browse files
committed
Replace Yarn Berry by PNPM
1 parent 0bb9d66 commit d25f4cb

File tree

42 files changed

+12254
-14695
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+12254
-14695
lines changed

.github/workflows/app-tests.yaml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ jobs:
3636
- uses: actions/setup-node@v4
3737
with:
3838
node-version-file: '.nvmrc'
39-
cache: 'yarn'
39+
cache: 'pnpm'
4040
cache-dependency-path: |
41-
yarn.lock
4241
package.json
4342
src/**/package.json
43+
test_apps/encore-app/pnpm-lock.yaml
4444
test_apps/encore-app/package.json
4545
4646
- uses: shivammathur/setup-php@v2
@@ -54,33 +54,29 @@ jobs:
5454
run: php .github/build-packages.php
5555

5656
# We always install PHP deps because of the UX Translator, which requires `var/translations` to exists
57-
- name: Install App dependencies
57+
- name: Install PHP dependencies
5858
uses: ramsey/composer-install@v3
5959
with:
6060
working-directory: test_apps/encore-app
6161
dependency-versions: highest
6262

63-
- if: matrix.ux-packages-source == 'php-vendor'
64-
name: Refresh dependencies from vendor/
65-
working-directory: test_apps/encore-app
66-
run: yarn
67-
env:
68-
YARN_ENABLE_HARDENED_MODE: 0
69-
YARN_ENABLE_IMMUTABLE_INSTALLS: 0
63+
- working-directory: test_apps/encore-app
64+
run: pnpm install
7065

7166
- if: matrix.ux-packages-source == 'js-packages'
7267
name: Install UX JS packages with a JS package manager
7368
working-directory: test_apps/encore-app
7469
run: |
7570
PACKAGES_TO_INSTALL=''
76-
for PACKAGE in $(cd ../..; yarn workspaces list --no-private --json); do
77-
PACKAGE_DIR=../../$(echo $PACKAGE | jq -r '.location')
78-
PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL $PACKAGE_DIR"
71+
for PACKAGE in $(cd ../..; pnpm ls -r --json --depth -1 | jq 'map(select(.private != true))' | jq -c '.[]'); do
72+
PACKAGE_ABSOLUTE_PATH=$(echo $PACKAGE | jq -r '.path')
73+
PACKAGE_RELATIVE_PATH=$(realpath --relative-to=. "$PACKAGE_ABSOLUTE_PATH")
74+
PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL file:$PACKAGE_RELATIVE_PATH"
7975
done
8076
echo "Installing packages: $PACKAGES_TO_INSTALL"
81-
yarn add --dev $PACKAGES_TO_INSTALL
77+
pnpm add --save-dev $PACKAGES_TO_INSTALL
8278
83-
- name: Ensure UX packages are installed from "${{ matrix.ux-packages-source == 'php-vendor' && 'vendor/symfony/ux-...' || '../../../src/**/assets' }}"
79+
- name: Ensure UX packages are installed from "${{ env.EXPECTED_PATTERN }}"
8480
working-directory: test_apps/encore-app
8581
run: |
8682
for PACKAGE in $(cat package.json | jq -c '(.dependencies // {}) + (.devDependencies // {}) | to_entries[] | select(.key | startswith("@symfony/ux-")) | {name: .key, version: .value}'); do
@@ -97,12 +93,12 @@ jobs:
9793
fi
9894
done;
9995
env:
100-
EXPECTED_PATTERN: ${{ matrix.ux-packages-source == 'php-vendor' && 'file:vendor/symfony/*' || '../../src/*' }}
96+
EXPECTED_PATTERN: ${{ matrix.ux-packages-source == 'php-vendor' && 'file:vendor/symfony/*' || 'file:../../src/*' }}
10197

102-
- name: Run Encore (dev)
98+
- name: Ensure project can be built in dev mode
10399
working-directory: test_apps/encore-app
104-
run: yarn encore dev
100+
run: pnpm run dev
105101

106-
- name: Run Encore (prod)
102+
- name: Ensure project can be built in prod mode
107103
working-directory: test_apps/encore-app
108-
run: yarn encore production
104+
run: pnpm run build

.github/workflows/code-quality.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ jobs:
2626
- uses: actions/setup-node@v4
2727
with:
2828
node-version-file: '.nvmrc'
29-
cache: 'yarn'
30-
- run: yarn --immutable
31-
- run: yarn ci
29+
cache: 'pnpm'
30+
- run: pnpm install --frozen-lockfile
31+
- run: pnpm run ci
3232

3333
coding-style-php:
3434
runs-on: ubuntu-latest

.github/workflows/dist-files-unbuilt.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ jobs:
2525
- uses: actions/setup-node@v4
2626
with:
2727
node-version-file: '.nvmrc'
28-
cache: 'yarn'
28+
cache: 'pnpm'
2929
cache-dependency-path: |
30-
yarn.lock
30+
pnpm-lock.yaml
3131
**/package.json
32-
- run: yarn --immutable && yarn build
32+
- run: pnpm install --frozen-lockfile && pnpm run build
3333

3434
- name: Check if JS dist files are current
3535
run: |

.github/workflows/release-on-npm.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,25 @@ jobs:
2525
- uses: actions/setup-node@v4
2626
with:
2727
node-version-file: '.nvmrc'
28-
cache: 'yarn'
28+
cache: 'pnpm'
2929
cache-dependency-path: |
30-
yarn.lock
30+
pnpm-lock.yaml
3131
package.json
3232
src/**/package.json
33-
- run: yarn --immutable
33+
- run: pnpm install --frozen-lockfile
3434

3535
- name: Update version of JS packages
36-
run: yarn workspaces foreach -pA exec "npm version ${{ env.VERSION }} --no-git-tag-version --no-workspaces-update"
36+
run: pnpm version ${{ env.VERSION }} --no-git-tag-version --workspaces --no-workspaces-update
3737

3838
- name: Commit changes
3939
run: |
4040
git add .
4141
git commit -m "Update versions to ${{ env.VERSION }}"
4242
43-
- name: Replace local "workspace:*" occurrences
44-
run: |
45-
yarn workspaces foreach -pA exec "sed -i 's/\"workspace:\*\"/\"${{ env.VERSION }}\"/g' package.json"
46-
4743
- name: Publish on NPM
4844
env:
4945
NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
50-
run: yarn workspaces foreach -A --no-private npm publish --access public --tolerate-republish
46+
run: pnpm publish --recursive --access public --no-git-checks
5147

5248
- name: Push changes
5349
env:

.github/workflows/unit-tests.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ jobs:
143143
- uses: actions/setup-node@v4
144144
with:
145145
node-version: ${{ matrix.node-version }}
146-
cache: 'yarn'
146+
cache: 'pnpm'
147147
cache-dependency-path: |
148-
yarn.lock
148+
pnpm-lock.yaml
149149
package.json
150150
src/**/package.json
151-
- run: yarn --immutable
152-
- run: yarn playwright install
153-
- run: yarn test
151+
- run: pnpm install --frozen-lockfile
152+
- run: pnpm exec playwright install
153+
- run: pnpm run test

.gitignore

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
2-
.yarn/*
3-
!.yarn/cache
4-
!.yarn/patches
5-
!.yarn/plugins
6-
!.yarn/releases
7-
!.yarn/sdks
8-
!.yarn/versions
9-
1+
vendor/
102
node_modules
11-
yarn-error.log
123

134
.doctor-rst.cache
145
.php-cs-fixer.cache

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22.6
1+
22.11

.yarnrc.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing
2-
3-
Thank you for considering contributing to Symfony UX!
2+
3+
Thank you for considering contributing to Symfony UX!
44

55
Symfony UX is an open source, community-driven project, and we are happy to receive contributions from the community!
66

@@ -39,15 +39,15 @@ To set up the development environment, you need the following tools:
3939

4040
- [PHP](https://www.php.net/downloads.php) 8.1 or higher
4141
- [Composer](https://getcomposer.org/download/)
42-
- [Node.js](https://nodejs.org/en/download/package-manager) 22 or higher
42+
- [Node.js](https://nodejs.org/en/download/package-manager) 22.11 or higher
4343
- [Corepack](https://github.com/nodejs/corepack)
44-
- [Yarn](https://yarnpkg.com/) 4 or higher
44+
- [PNPM](https://pnpm.io/) 10.13 or higher
4545

4646
With these tools installed, you can install the project dependencies:
4747

4848
```shell
4949
$ composer install
50-
$ corepack enable && yarn install
50+
$ corepack enable && pnpm install
5151
```
5252

5353
### Linking Symfony UX packages to your project
@@ -79,17 +79,17 @@ Assets are specific to each Symfony UX package:
7979
- Assets **must be** compatible with the [Symfony AssetMapper](https://symfony.com/doc/current/frontend/asset_mapper.html) and [Symfony Webpack Encore](https://symfony.com/doc/current/frontend/encore/index.html).
8080

8181
To help you with assets, you can run the following commands in a specific package directory (e.g., `src/Map/assets/`):
82-
- `yarn run build`: build (compile) assets from the package,
83-
- `yarn run watch`: watch for modifications and rebuild assets from the package,
84-
- `yarn run test`: run the tests from the package,
85-
- `yarn run check`: run the formatter, linter, and sort imports, and fails if any modifications
86-
- `yarn run check --write`: run the formatter, linter, imports sorting, and write modifications
87-
88-
Thanks to [Yarn Workspaces](https://yarnpkg.com/features/workspaces), you can also run these commands from the root directory of the project:
89-
- `yarn run build`: build (compile) assets from **all** packages,
90-
- `yarn run test`: run the tests from **all** packages,
91-
- `yarn run check`: run the formatter, linter, and sort imports for **all** packages, and fails if any modifications
92-
- `yarn run check --write`: run the formatter, linter, imports sorting for **all** packages, and write modifications
82+
- `pnpm run build`: build (compile) assets from the package,
83+
- `pnpm run watch`: watch for modifications and rebuild assets from the package,
84+
- `pnpm run test`: run the tests from the package,
85+
- `pnpm run check`: run the formatter, linter, and sort imports, and fails if any modifications
86+
- `pnpm run check --write`: run the formatter, linter, imports sorting, and write modifications
87+
88+
Thanks to [PNPM Workspaces](https://pnpm.io/workspaces), you can also run these commands from the root directory of the project:
89+
- `pnpm run build`: build (compile) assets from **all** packages,
90+
- `pnpm run test`: run the tests from **all** packages,
91+
- `pnpm run check`: run the formatter, linter, and sort imports for **all** packages, and fails if any modifications
92+
- `pnpm run check --write`: run the formatter, linter, imports sorting for **all** packages, and write modifications
9393

9494
### Working on documentation
9595

bin/test_package.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fi
2323

2424
runTestSuite() {
2525
echo -e "Running tests for $workspace...\n"
26-
yarn run -T vitest --run || { all_tests_passed=false; }
26+
pnpm exec vitest --run || { all_tests_passed=false; }
2727
}
2828

2929
processWorkspace() {
@@ -39,15 +39,15 @@ processWorkspace() {
3939
echo "No package.json found at $package_json_path"
4040
return
4141
fi
42-
42+
4343
workspace=$(jq -r '.name' "$package_json_path")
4444
if [ -z "$workspace" ]; then
4545
echo "No name found in package.json at $package_json_path"
4646
return
4747
fi
48-
48+
4949
echo -e "Processing workspace $workspace at location $location...\n"
50-
50+
5151
echo "Checking '$package_json_path' for peerDependencies and importmap dependencies to have the same version"
5252
deps=$(jq -r '.peerDependencies | keys[]' "$package_json_path")
5353
for library in $deps; do
@@ -76,15 +76,15 @@ processWorkspace() {
7676
if [ -n "$trimmed_version" ]; then
7777
# Install each version of the library separately
7878
echo -e " - Install $library@$trimmed_version for $workspace\n"
79-
yarn workspace "$workspace" add "$library@$trimmed_version" --peer
79+
pnpm add "$library@$trimmed_version" --save-peer --filter "$workspace"
8080

8181
runTestSuite
8282
fi
8383
done
84-
85-
echo " -> Reverting version changes for $library"
86-
yarn workspace "$workspace" add "$library@$versionValue" --peer
8784
done
85+
86+
echo " -> Reverting version changes from $package_json_path"
87+
git checkout -- "$package_json_path"
8888
else
8989
echo -e " -> No peerDependencies found with multiple versions defined\n"
9090
runTestSuite

0 commit comments

Comments
 (0)