Skip to content

Commit 028a4e6

Browse files
committed
minor #2222 Migrate from Yarn Classic to Yarn Berry (Kocal)
This PR was merged into the 2.x branch. Discussion ---------- Migrate from Yarn Classic to Yarn Berry | Q | A | ------------- | --- | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - For new features, provide some code snippets to help understand usage. - Features and deprecations must be submitted against branch main. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> [Yarn 1.x](https://github.com/yarnpkg/yarn) is _dead_ since 4 years now: <img width="1386" alt="image" src="https://github.com/user-attachments/assets/501690af-876c-4917-91db-9131baceeea4"> all new features and bug fixes are done on [Yarn Berry](https://github.com/yarnpkg/berry): <img width="1345" alt="image" src="https://github.com/user-attachments/assets/bd515845-0c05-4eec-af89-8240c0e88428"> I've adapted our CI, our building and testing scripts. Updates on `src/**/assets/packages.json` are simply dependencies alphabetical sorting. The `yarn.lock` has been re-generated to the new structure (but locked versions are still the same). Commits ------- 4806ecb Migrate from Yarn Classic to Yarn Berry
2 parents 1720a47 + 4806ecb commit 028a4e6

File tree

14 files changed

+10457
-6993
lines changed

14 files changed

+10457
-6993
lines changed

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/.yarn/** linguist-vendored
2+
/.yarn/releases/* binary
3+
/.yarn/plugins/**/* binary
4+
/.pnp.* binary linguist-generated

.github/workflows/test-turbo.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ jobs:
6262
- name: Checkout
6363
uses: actions/checkout@v4
6464

65+
- run: corepack enable
66+
6567
- name: Setup PHP
6668
uses: shivammathur/setup-php@v2
6769
with:
@@ -75,7 +77,7 @@ jobs:
7577

7678
- name: Get yarn cache directory path
7779
id: yarn-cache-dir-path
78-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
80+
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
7981

8082
- uses: actions/cache@v4
8183
id: yarn-cache
@@ -87,7 +89,7 @@ jobs:
8789
8890
- name: Install JavaScript dependencies
8991
working-directory: src/Turbo/tests/app
90-
run: yarn install
92+
run: touch yarn.lock && yarn install --mode update-lockfile && yarn install
9193

9294
- name: Build JavaScript
9395
working-directory: src/Turbo/tests/app

.github/workflows/test.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
19+
- run: corepack enable
1920
- name: Get yarn cache directory path
2021
id: yarn-cache-dir-path
21-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
22+
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
2223
- uses: actions/cache@v4
2324
id: yarn-cache
2425
with:
2526
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
2627
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
2728
restore-keys: |
2829
${{ runner.os }}-yarn-
29-
- run: yarn --frozen-lockfile
30+
- run: yarn --immutable
3031
- run: yarn check-lint
3132
- run: yarn check-format
3233

@@ -35,17 +36,18 @@ jobs:
3536
runs-on: ubuntu-latest
3637
steps:
3738
- uses: actions/checkout@v4
39+
- run: corepack enable
3840
- name: Get yarn cache directory path
3941
id: yarn-cache-dir-path
40-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
42+
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
4143
- uses: actions/cache@v4
4244
id: yarn-cache
4345
with:
4446
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
4547
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
4648
restore-keys: |
4749
${{ runner.os }}-yarn-
48-
- run: yarn --frozen-lockfile && yarn build
50+
- run: yarn --immutable && yarn build
4951
- name: Check if js dist files are current
5052
id: changes
5153
run: |
@@ -132,9 +134,10 @@ jobs:
132134
runs-on: ubuntu-latest
133135
steps:
134136
- uses: actions/checkout@v4
137+
- run: corepack enable
135138
- name: Get yarn cache directory path
136139
id: yarn-cache-dir-path
137-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
140+
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
138141
- uses: actions/cache@v4
139142
id: yarn-cache
140143
with:

.gitignore

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1-
.doctor-rst.cache
2-
.php-cs-fixer.cache
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+
310
node_modules
411
yarn-error.log
12+
13+
.doctor-rst.cache
14+
.php-cs-fixer.cache
515
/composer.lock
616
/vendor

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

bin/run-vitest-all.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fi
1111

1212
runTestSuite() {
1313
echo -e "Running tests for $workspace...\n"
14-
yarn workspace $workspace run vitest --run || { all_tests_passed=false; }
14+
yarn workspace $workspace run -T vitest --run || { all_tests_passed=false; }
1515
}
1616

1717
processWorkspace() {
@@ -48,19 +48,21 @@ processWorkspace() {
4848
fi
4949
}
5050

51-
# Get all workspace names
52-
workspaces_info=$(yarn -s workspaces info)
53-
5451
# Iterate over each workspace using process substitution
5552
while IFS= read -r workspace_info; do
5653
# Split the workspace_info into workspace and location
57-
workspace=$(echo "$workspace_info" | awk '{print $1}')
58-
location=$(echo "$workspace_info" | awk '{print $2}')
54+
workspace=$(echo "$workspace_info" | jq -r '.name')
55+
location=$(echo "$workspace_info" | jq -r '.location')
56+
57+
# Skip the root workspace
58+
if [ $workspace == "null" ]; then
59+
continue
60+
fi
5961

6062
# Call the function to process the workspace
6163
processWorkspace "$workspace" "$location"
6264

63-
done < <(echo "$workspaces_info" | jq -r 'to_entries[0:] | .[] | "\(.key) \(.value.location)"')
65+
done < <(yarn workspaces list --json)
6466

6567
# Check the flag at the end and exit with code 1 if any test failed
6668
if [ "$all_tests_passed" = false ]; then

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"src/*/src/Bridge/*/assets/src/**",
1414
"src/*/src/Bridge/*/assets/test/**"
1515
],
16-
"ignore": ["**/composer.json", "**/vendor", "**/node_modules"]
16+
"ignore": ["**/composer.json", "**/vendor", "**/package.json", "**/node_modules"]
1717
},
1818
"linter": {
1919
"rules": {

package.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"private": true,
3-
"workspaces": ["src/*/assets", "src/*/src/Bridge/*/assets"],
3+
"packageManager": "[email protected]",
4+
"workspaces": [
5+
"src/*/assets",
6+
"src/*/src/Bridge/*/assets"
7+
],
48
"scripts": {
59
"build": "node bin/build_javascript.js && node bin/build_styles.js",
610
"test": "bin/run-vitest-all.sh",
@@ -28,12 +32,11 @@
2832
"vitest": "^2.1.1"
2933
},
3034
"resolutions": {
31-
"@swup/prettier-config": "link:node_modules/.cache/null",
32-
"@swup/browserslist-config": "link:node_modules/.cache/null",
33-
"microbundle": "link:node_modules/.cache/null",
34-
"prettier": "link:node_modules/.cache/null",
35-
"shelljs": "link:node_modules/.cache/null",
36-
"shelljs-live": "link:node_modules/.cache/null"
37-
},
38-
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
35+
"@swup/plugin/@swup/prettier-config": "link:node_modules/.cache/null",
36+
"@swup/plugin/@swup/browserslist-config": "link:node_modules/.cache/null",
37+
"@swup/plugin/microbundle": "link:node_modules/.cache/null",
38+
"@swup/plugin/prettier": "link:node_modules/.cache/null",
39+
"@swup/plugin/shelljs": "link:node_modules/.cache/null",
40+
"@swup/plugin/shelljs-live": "link:node_modules/.cache/null"
41+
}
3942
}

src/Cropperjs/assets/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
}
2828
},
2929
"peerDependencies": {
30-
"cropperjs": "^1.5.9",
31-
"@hotwired/stimulus": "^3.0.0"
30+
"@hotwired/stimulus": "^3.0.0",
31+
"cropperjs": "^1.5.9"
3232
},
3333
"devDependencies": {
34-
"cropperjs": "^1.5.9",
35-
"@hotwired/stimulus": "^3.0.0"
34+
"@hotwired/stimulus": "^3.0.0",
35+
"cropperjs": "^1.5.9"
3636
}
3737
}

src/Swup/assets/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@
2424
}
2525
},
2626
"peerDependencies": {
27+
"@hotwired/stimulus": "^3.0.0",
28+
"@swup/debug-plugin": "^3.0",
2729
"@swup/fade-theme": "^1.0",
28-
"@swup/slide-theme": "^1.0",
2930
"@swup/forms-plugin": "^2.0",
30-
"@swup/debug-plugin": "^3.0",
31-
"swup": "^3.0",
32-
"@hotwired/stimulus": "^3.0.0"
31+
"@swup/slide-theme": "^1.0",
32+
"swup": "^3.0"
3333
},
3434
"devDependencies": {
35+
"@hotwired/stimulus": "^3.0.0",
36+
"@swup/debug-plugin": "^3.0",
3537
"@swup/fade-theme": "^1.0",
36-
"@swup/slide-theme": "^1.0",
3738
"@swup/forms-plugin": "^2.0",
38-
"@swup/debug-plugin": "^3.0",
39-
"swup": "^3.0",
40-
"@hotwired/stimulus": "^3.0.0"
39+
"@swup/slide-theme": "^1.0",
40+
"swup": "^3.0"
4141
}
4242
}

src/Turbo/assets/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
}
2727
},
2828
"peerDependencies": {
29-
"@hotwired/turbo": "^7.1.1 || ^8.0",
30-
"@hotwired/stimulus": "^3.0.0"
29+
"@hotwired/stimulus": "^3.0.0",
30+
"@hotwired/turbo": "^7.1.1 || ^8.0"
3131
},
3232
"devDependencies": {
33-
"@hotwired/turbo": "^7.1.0 || ^8.0",
34-
"@hotwired/stimulus": "^3.0.0"
33+
"@hotwired/stimulus": "^3.0.0",
34+
"@hotwired/turbo": "^7.1.0 || ^8.0"
3535
}
3636
}

src/Turbo/tests/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"packageManager": "[email protected]",
23
"devDependencies": {
34
"@babel/core": "^7.20.12",
45
"@babel/preset-env": "^7.20.2",

src/Typed/assets/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
}
2222
},
2323
"peerDependencies": {
24-
"typed.js": "^2.0",
25-
"@hotwired/stimulus": "^3.0.0"
24+
"@hotwired/stimulus": "^3.0.0",
25+
"typed.js": "^2.0"
2626
},
2727
"devDependencies": {
28-
"typed.js": "^2.0",
29-
"@hotwired/stimulus": "^3.0.0"
28+
"@hotwired/stimulus": "^3.0.0",
29+
"typed.js": "^2.0"
3030
}
3131
}

0 commit comments

Comments
 (0)