Skip to content

Commit e470e94

Browse files
committed
CONSOLE-5011: migrate to yarn berry
1 parent 4f4970c commit e470e94

29 files changed

Lines changed: 30231 additions & 169021 deletions

File tree

.claude/settings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@
9696
"ask": [
9797
"Bash(yarn install:*)",
9898
"Bash(yarn add:*)",
99-
"Bash(yarn upgrade:*)",
99+
"Bash(yarn up:*)",
100100
"Bash(npm install:*)",
101101
"Bash(npm i:*)",
102102
"Bash(go get:*)",
103103
"Bash(go mod:*)",
104-
104+
105105
"Bash(oc delete:*)",
106106
"Bash(oc apply:*)",
107107
"Bash(oc create:*)",
@@ -129,4 +129,4 @@
129129
"Bash(yarn dev)"
130130
]
131131
}
132-
}
132+
}

.claude/skills/update-package/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Update the specified package to its reasonably latest stable version or to the v
1313

1414
### Phase 1: Analysis & Update
1515
1. **Identify**: Read `package.json` for current version (dependencies/devDependencies/resolutions)
16-
2. **Research**: Use `yarn info <package> version` for latest version
16+
2. **Research**: Use `yarn npm info <package> --json | jq -r '.["dist-tags"].latest'` to find latest version; compare with current version; determine if update is needed
1717
3. **Interactive Gather**: Ask user:
1818
- "Do you have a migration guide URL for this update?" (optional)
1919
- "Do you have a changelog/release notes URL?" (optional)

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
.vscode
44

55
# Yarn v4 (Berry)
6-
.pnp.*
76
.yarn/*
87
install-state.gz
98
!.yarn/patches

Dockerfile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,21 @@ ADD . .
1717

1818
USER 0
1919

20-
ARG YARN_VERSION=v1.22.22
20+
ARG COREPACK_VERSION=0.34.6
2121

22-
# bootstrap yarn so we can install and run the other tools.
23-
RUN CACHED_YARN=./artifacts/yarn-${YARN_VERSION}.tar.gz; \
24-
if [ -f ${CACHED_YARN} ]; then \
25-
npm install ${CACHED_YARN}; \
22+
# bootstrap corepack so we can install and run the other tools.
23+
RUN CACHED_COREPACK=./artifacts/corepack-${COREPACK_VERSION}.tar.gz; \
24+
if [ -f ${CACHED_COREPACK} ]; then \
25+
npm install --global ${CACHED_COREPACK}; \
2626
else \
27-
npm install https://github.com/yarnpkg/yarn/releases/download/${YARN_VERSION}/yarn-${YARN_VERSION}.tar.gz; \
27+
npm install --global https://github.com/nodejs/corepack/releases/download/v${COREPACK_VERSION}/corepack.tgz; \
2828
fi
2929

30+
RUN npx corepack enable
31+
32+
# assume our package manager is safe to download
33+
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
34+
3035
# The REMOTE_SOURCES value is set by the build system to indicate the location of the cachito-backed artifacts cache.
3136
# As cachito might not be available in all environments, we need to make sure the value is set before trying to use it and
3237
# that the COPY layer below doesn't fail. Setting it to be the Dockerfile itself is fairly safe, as it will always be
@@ -39,7 +44,7 @@ COPY $REMOTE_SOURCES $REMOTE_SOURCES_DIR
3944
# use dependencies provided by Cachito
4045
RUN test -d ${REMOTE_SOURCES}/cachito-gomod-with-deps || exit 0; \
4146
cp -f $REMOTE_SOURCES_DIR/cachito-gomod-with-deps/app/registry-ca.pem . \
42-
&& cp -f $REMOTE_SOURCES_DIR/cachito-gomod-with-deps/app/frontend/{.npmrc,.yarnrc,yarn.lock} frontend/
47+
&& cp -f $REMOTE_SOURCES_DIR/cachito-gomod-with-deps/app/frontend/{.npmrc,.yarnrc.yml,yarn.lock} frontend/
4348

4449
# prevent download of cypress binary as part of module installs
4550
ENV CYPRESS_INSTALL_BINARY=0

Dockerfile.builder

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010

1111
FROM golang:1.22-bullseye
1212

13-
### Install NodeJS and yarn
13+
### Install NodeJS and corepack
1414
ENV NODE_VERSION="v22.14.0"
15-
ENV YARN_VERSION="v1.22.22"
15+
ENV COREPACK_VERSION="0.34.6"
16+
17+
# assume our package manager is safe to download
18+
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
1619

1720
# yarn needs a home writable by any user running the container
1821
ENV HOME=/opt/home
@@ -43,9 +46,6 @@ RUN chmod 777 /usr/local/lib/node_modules
4346
# cleanup
4447
RUN rm -rf /tmp/node-v*
4548

46-
RUN cd /tmp && \
47-
wget --quiet -O /tmp/yarn.tar.gz https://github.com/yarnpkg/yarn/releases/download/${YARN_VERSION}/yarn-${YARN_VERSION}.tar.gz && \
48-
tar xf yarn.tar.gz && \
49-
rm -f /tmp/yarn.tar.gz && \
50-
mv /tmp/yarn-${YARN_VERSION} /usr/local/yarn && \
51-
ln -s /usr/local/yarn/bin/yarn /usr/local/bin/yarn
49+
# Install corepack
50+
RUN npm install -g corepack@${COREPACK_VERSION} && \
51+
corepack enable

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The console is a more friendly `kubectl` in the form of a single page webapp. It
1515

1616
### Dependencies:
1717

18-
1. [node.js](https://nodejs.org/) >= 22 & [yarn classic](https://classic.yarnpkg.com/en/docs/install) >= 1.20
18+
1. [node.js](https://nodejs.org/) >= 22 with [corepack](https://npmjs.com/package/corepack) enabled for [yarn berry](https://yarnpkg.com/)
1919
2. [go](https://golang.org/) >= 1.22+
2020
3. [oc](https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/) or [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) and an OpenShift or Kubernetes cluster
2121
4. [jq](https://stedolan.github.io/jq/download/) (for `contrib/environment.sh`)
@@ -407,20 +407,19 @@ yarn add <package@version>
407407
Update existing frontend dependencies:
408408

409409
```
410-
yarn upgrade <package@version>
410+
yarn up <package@version>
411411
```
412412

413-
To upgrade yarn itself, download a new yarn release from
414-
<https://github.com/yarnpkg/yarn/releases>, replace the release in
415-
`frontend/.yarn/releases` with the new version, and update `yarn-path` in
416-
`frontend/.yarnrc`.
413+
To upgrade yarn itself, run `yarn set version <version>` in `frontend` directory. This will update the yarn
414+
release file in `frontend/.yarn/releases` and the `yarnPath` in `frontend/.yarnrc.yml`, as well as the
415+
`packageManager` field in `frontend/package.json`.
417416

418417
##### @patternfly
419418

420419
Note that when upgrading @patternfly packages, we've seen in the past that it can cause the JavaScript heap to run out of memory, or the bundle being too large if multiple versions of the same @patternfly package is pulled in. To increase efficiency, run the following after updating packages:
421420

422421
```
423-
yarn run dedupe-deps --scopes @patternfly
422+
yarn dedupe --strategy highest
424423
```
425424

426425
Please note that PatternFly releases do not strictly follow semantic versioning. Therefore, it's important

dynamic-demo-plugin/.yarn/releases

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../frontend/.yarn/releases

dynamic-demo-plugin/.yarnrc

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

dynamic-demo-plugin/.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../frontend/.yarnrc.yml

dynamic-demo-plugin/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
"build": "yarn clean && NODE_ENV=production yarn ts-node node_modules/.bin/webpack",
88
"build-dev": "yarn clean && yarn ts-node node_modules/.bin/webpack",
99
"build-plugin-sdk": "yarn --cwd ../frontend build-plugin-sdk && yarn install-plugin-sdk",
10-
"install-plugin-sdk": "rm -rf node_modules/@openshift-console && yarn install --check-files",
10+
"install-plugin-sdk": "rm -rf node_modules/@openshift-console && yarn install",
1111
"start-console": "./start-console.sh",
1212
"http-server": "./http-server.sh dist",
13-
"i18n": "i18next \"src/**/*.{js,jsx,ts,tsx}\" [-oc] -c i18next-parser.config.js",
14-
"ts-node": "ts-node -O '{\"module\":\"commonjs\"}'"
13+
"i18n": "i18next \"src/**/*.{js,jsx,ts,tsx}\" -c i18next-parser.config.js",
14+
"ts-node": "NODE_OPTIONS='--preserve-symlinks' ts-node -O '{\"module\":\"commonjs\"}'"
1515
},
1616
"devDependencies": {
17-
"@openshift-console/dynamic-plugin-sdk": "file:../frontend/packages/console-dynamic-plugin-sdk/dist/core",
18-
"@openshift-console/dynamic-plugin-sdk-webpack": "file:../frontend/packages/console-dynamic-plugin-sdk/dist/webpack",
17+
"@openshift-console/dynamic-plugin-sdk": "portal:../frontend/packages/console-dynamic-plugin-sdk/dist/core",
18+
"@openshift-console/dynamic-plugin-sdk-webpack": "portal:../frontend/packages/console-dynamic-plugin-sdk/dist/webpack",
1919
"@patternfly/react-core": "^6.2.2",
2020
"@patternfly/react-icons": "^6.2.2",
2121
"@patternfly/react-table": "^6.2.2",
@@ -77,5 +77,6 @@
7777
"utilityConsumer": "./components/UtilityConsumer.tsx",
7878
"yamlEditor": "./components/YAMLEditorPage.tsx"
7979
}
80-
}
80+
},
81+
"packageManager": "yarn@4.12.0"
8182
}

0 commit comments

Comments
 (0)