Skip to content

Commit 0b9b06a

Browse files
committed
CONSOLE-5011: bump to yarn berry
1 parent cc32002 commit 0b9b06a

36 files changed

Lines changed: 35264 additions & 170987 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 & 8 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.19
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
@@ -72,4 +77,3 @@ LABEL \
7277
io.k8s.display-name="OpenShift Console" \
7378
vendor="Red Hat" \
7479
io.openshift.tags="openshift,console"
75-

Dockerfile.builder

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ FROM golang:1.22-bullseye
1313
### For golang testing stuff
1414
RUN go install github.com/jstemmer/go-junit-report@latest
1515

16-
### Install NodeJS and yarn
17-
ENV NODE_VERSION="v18.18.1"
18-
ENV YARN_VERSION="v1.22.10"
16+
### Install NodeJS and corepack
17+
ENV NODE_VERSION="v22.14.0"
18+
ENV COREPACK_VERSION="0.34.6"
19+
20+
# assume our package manager is safe to download
21+
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
1922

2023
# yarn needs a home writable by any user running the container
2124
ENV HOME /opt/home
@@ -46,9 +49,6 @@ RUN chmod 777 /usr/local/lib/node_modules
4649
# cleanup
4750
RUN rm -rf /tmp/node-v*
4851

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

Dockerfile.plugins.demo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN mkdir -p /src/console
99
COPY . /src/console
1010

1111
WORKDIR /src/console/frontend
12-
RUN yarn install
12+
RUN yarn install && yarn generate
1313

1414
WORKDIR /src/console/dynamic-demo-plugin
1515
RUN yarn install && \

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/) >= 18 & [yarn](https://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`)
@@ -395,20 +395,19 @@ yarn add <package@version>
395395
Update existing frontend dependencies:
396396

397397
```
398-
yarn upgrade <package@version>
398+
yarn up <package@version>
399399
```
400400

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

406405
##### @patternfly
407406

408407
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:
409408

410409
```
411-
npx yarn-deduplicate --scopes @patternfly
410+
yarn dedupe --strategy highest
412411
```
413412

414413
#### 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)