Skip to content

Commit 3806055

Browse files
committed
CONSOLE-5011: bump to yarn berry
1 parent ed2d722 commit 3806055

35 files changed

Lines changed: 36150 additions & 172408 deletions

File tree

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
.env
22
.idea
33
.vscode
4+
5+
# Yarn v4 (Berry)
6+
.yarn/*
7+
install-state.gz
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/sdks
12+
!.yarn/versions
413
!/vendor/**
514
!.vscode/settings.json
615
.DS_Store

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`)
@@ -398,20 +398,19 @@ yarn add <package@version>
398398
Update existing frontend dependencies:
399399

400400
```
401-
yarn upgrade <package@version>
401+
yarn up <package@version>
402402
```
403403

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

409408
##### @patternfly
410409

411410
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:
412411

413412
```
414-
npx yarn-deduplicate --scopes @patternfly
413+
yarn dedupe --strategy highest
415414
```
416415

417416
#### Supported Browsers

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: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@
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",
19-
"@openshift-console/plugin-shared": "file:../frontend/packages/console-plugin-shared/dist",
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",
19+
"@openshift-console/plugin-shared": "portal:../frontend/packages/console-plugin-shared/dist",
2020
"@patternfly/react-core": "^6.2.2",
2121
"@patternfly/react-icons": "^6.2.2",
2222
"@patternfly/react-table": "^6.2.2",
23-
"@types/react": "16.8.13",
23+
"@types/react": "17.x",
2424
"@types/react-router": "^5.1.20",
2525
"@types/react-router-dom": "5.3.x",
2626
"copy-webpack-plugin": "^6.4.1",
@@ -29,8 +29,8 @@
2929
"http-server": "0.12.x",
3030
"i18next-parser": "^3.3.0",
3131
"js-yaml": "^4.1.0",
32-
"react": "17.0.1",
33-
"react-dom": "17.0.1",
32+
"react": "17.0.2",
33+
"react-dom": "17.0.2",
3434
"react-i18next": "^11.7.3",
3535
"react-router": "5.3.x",
3636
"react-router-dom": "5.3.x",
@@ -76,5 +76,6 @@
7676
"disableStaticPlugins": [
7777
"@console/demo-plugin"
7878
]
79-
}
79+
},
80+
"packageManager": "yarn@4.12.0"
8081
}

dynamic-demo-plugin/src/components/ProjectOverview/Inventory.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as React from 'react';
21
import {
32
K8sResourceCommon,
43
useK8sWatchResource,

0 commit comments

Comments
 (0)