Skip to content

Commit 29b4959

Browse files
chore: update yarn to v4 (#5010)
1 parent ce841fe commit 29b4959

File tree

12 files changed

+39760
-27479
lines changed

12 files changed

+39760
-27479
lines changed

.circleci/config.yml

+26-26
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,18 @@ commands:
2222
downstream:
2323
steps:
2424
- checkout
25-
# - restore_cache:
26-
# keys:
27-
# - v4c-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}
28-
# - restore_cache:
29-
# keys:
30-
# - v4b-<< pipeline.parameters.wireit_cache_name >>-{{ arch }}-{{ checksum "package.json" }}-
25+
- restore_cache:
26+
keys:
27+
- v4c-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}
28+
- restore_cache:
29+
keys:
30+
- v4b-<< pipeline.parameters.wireit_cache_name >>-{{ arch }}-{{ checksum "package.json" }}-
3131
- run:
3232
name: Installing Dependencies
33-
command: yarn --frozen-lockfile --cache-folder ~/.cache/yarn
33+
command: |
34+
corepack enable
35+
yarn --immutable
36+
3437
- save_cache:
3538
paths:
3639
- ~/.cache/yarn
@@ -85,14 +88,14 @@ commands:
8588
if [[ $(cat count_start.txt) -eq $(cat count_end.txt) ]]; then exit 0; else exit 1; fi
8689
# build diff review site
8790
- run:
88-
when: on_fail
91+
when: always
8992
name: Create review site
9093
command: |
9194
branch=$(git symbolic-ref --short HEAD)
9295
node test/visual/review.js --branch=$branch --commit=<< pipeline.git.revision >> --system="<< parameters.regression_system >> << parameters.regression_color >> << parameters.regression_scale >> << parameters.regression_dir >>"
9396
yarn rollup -c test/visual/rollup.config.js
9497
- run:
95-
when: on_fail
98+
when: always
9699
name: Publish review site
97100
command: |
98101
cp projects/documentation/content/favicon.ico test/visual
@@ -123,18 +126,7 @@ jobs:
123126
executor: node
124127

125128
steps:
126-
- checkout
127-
- restore_cache:
128-
keys:
129-
- v3b-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}
130-
- run:
131-
name: Installing Dependencies
132-
command: yarn --ignore-scripts --frozen-lockfile --cache-folder ~/.cache/yarn
133-
- save_cache:
134-
paths:
135-
- ~/.cache/yarn
136-
- .wireit
137-
key: v3b-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}
129+
- downstream
138130
- run:
139131
name: Define environment variable with lastest commit's message
140132
command: |
@@ -211,12 +203,20 @@ jobs:
211203

212204
preview-docs:
213205
executor: node
214-
215206
steps:
216207
- downstream
217208
- run:
218-
name: Generate Docs
219-
command: yarn docs:preview
209+
name: Generate Custom Elements Manifest
210+
command: yarn docs:analyze
211+
- run:
212+
name: Move CEM to Storybook directory
213+
command: cp projects/documentation/custom-elements.json storybook/
214+
- run:
215+
name: Build documentation
216+
command: yarn docs:build
217+
- run:
218+
name: Build Storybook
219+
command: yarn storybook:build
220220
- run: echo '/* /index.html 200' > projects/documentation/dist/_redirects
221221
- run: |
222222
branch=$(git symbolic-ref --short HEAD)
@@ -272,14 +272,14 @@ jobs:
272272
if [[ $(cat count_start.txt) -eq $(cat count_end.txt) ]]; then exit 0; else exit 1; fi
273273
# build diff review site
274274
- run:
275-
when: on_fail
275+
when: always
276276
name: Create review site
277277
command: |
278278
branch=$(git symbolic-ref --short HEAD)
279279
node test/visual/review.js --branch=$branch --commit=<< pipeline.git.revision >> --system="hcm"
280280
yarn rollup -c test/visual/rollup.config.js
281281
- run:
282-
when: on_fail
282+
when: always
283283
name: Publish review site
284284
command: |
285285
cp projects/documentation/content/favicon.ico test/visual

.gitattributes

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
README.md merge=ours
2+
3+
# Treat yarn assets as binaries for diffing
4+
/.yarn/releases/** binary
5+
/.yarn/plugins/** binary

.github/actions/setup-job/action.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ description: Common setup for all jobs
33
runs:
44
using: 'composite'
55
steps:
6+
- name: Enable Corepack
7+
shell: bash
8+
run: corepack enable
9+
610
- name: Setup Node 20
711
uses: actions/setup-node@v4
812
with:
@@ -12,4 +16,4 @@ runs:
1216

1317
- name: Install dependencies
1418
shell: bash
15-
run: yarn --frozen-lockfile
19+
run: yarn --immutable

.github/workflows/chromatic-vrt.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ jobs:
3232
with:
3333
fetch-depth: 0
3434

35-
- name: Setup Node 18
35+
- name: Setup Node 20
3636
uses: actions/setup-node@v4
3737
with:
38-
node-version: '18'
38+
node-version: '20'
3939
cache: 'yarn'
4040
registry-url: 'https://registry.npmjs.org'
4141

4242
- name: Install dependencies
43-
run: yarn --frozen-lockfile
43+
run: yarn --immutable
4444

4545
- name: Publish to Chromatic
4646
id: chromatic

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,12 @@ chromatic.log
103103
chromatic-build-*.xml
104104
chromatic-diagnostics*.json
105105
chromatic.config.json
106+
107+
# yarn
108+
.pnp.*
109+
.yarn/*
110+
!.yarn/patches
111+
!.yarn/plugins
112+
!.yarn/releases
113+
!.yarn/sdks
114+
!.yarn/versio;/

.yarn/releases/yarn-4.6.0.cjs

+934
Large diffs are not rendered by default.

.yarnrc.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
cacheFolder: ~/.cache/yarn
2+
nodeLinker: node-modules
3+
yarnPath: .yarn/releases/yarn-4.6.0.cjs
4+
# @todo: Remove enableScripts once pre/post install commands are migrated to the new Yarn 4 recommended pattern.
5+
enableScripts: true

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": "module",
77
"engines": {
88
"node": ">=20",
9-
"yarn": ">=1.16.0"
9+
"yarn": ">=4.6.0"
1010
},
1111
"scripts": {
1212
"analyze": "lit-analyzer \"{packages,tools}/*/src/**/!(*.css).ts\"",
@@ -433,5 +433,5 @@
433433
"tools/*",
434434
"react/*"
435435
],
436-
"packageManager": "yarn@1.22.22"
436+
"packageManager": "yarn@4.6.0"
437437
}

packages/icon/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"@spectrum-web-components/iconset": "^1.0.1"
8686
},
8787
"devDependencies": {
88-
"@spectrum-css/icon": "8.0.0-s2-foundations.17"
88+
"@spectrum-css/icon": "8.0.0-s2-foundations.16"
8989
},
9090
"types": "./src/index.d.ts",
9191
"customElements": "custom-elements.json",

storybook/preview.js

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ governing permissions and limitations under the License.
1111
*/
1212
import { setCustomElementsManifest } from '@storybook/web-components';
1313
import { swcThemeDecorator } from '@spectrum-web-components/story-decorator/decorator.js';
14+
1415
import cem from './custom-elements.json';
1516

1617
setCustomElementsManifest(cem);

tasks/build-preview-urls-comment.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ governing permissions and limitations under the License.
1313

1414
import slugify from '@sindresorhus/slugify';
1515
import crypto from 'crypto';
16-
import { getChangedPackages } from './get-changed-packages.js';
1716

1817
const createHash = (context) => {
1918
const md5 = crypto.createHash('md5');
@@ -22,8 +21,6 @@ const createHash = (context) => {
2221
};
2322

2423
export const buildPreviewURLComment = (ref) => {
25-
const packages = getChangedPackages();
26-
2724
// Extract the branch name from the ref and slugify it for URL usage
2825
const branch = ref.replace('refs/heads/', '');
2926
const branchSlug = slugify(branch);
@@ -82,11 +79,8 @@ export const buildPreviewURLComment = (ref) => {
8279
let comment = `## Branch preview
8380
8481
- [Documentation Site](https://${branchSlug}--spectrum-web-components.netlify.app/)
85-
- [Storybook](https://${branchSlug}--spectrum-web-components.netlify.app/storybook/)`;
82+
- [Storybook](https://${branchSlug}--spectrum-web-components.netlify.app/storybook/)
8683
87-
// If there are changed packages, add a section with visual regression test results
88-
if (packages.length > 0) {
89-
comment += `
9084
9185
9286
<h3><strong>Review the following VRT differences</strong></h3>
@@ -98,8 +92,6 @@ ${previewLinks.join('')}
9892
If the changes are expected, update the <code>current_golden_images_cache</code> hash in the circleci config to accept the new images. Instructions are included in that file.
9993
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.
10094
`;
101-
}
102-
10395
return comment;
10496
};
10597

0 commit comments

Comments
 (0)