Skip to content

Commit

Permalink
feat: migrate to yarn 3 (#1170)
Browse files Browse the repository at this point in the history
* feat: migrate to yarn 3

Signed-off-by: Oleksii Orel <oorel@redhat.com>

* fix: upgrade libs

Signed-off-by: Oleksii Orel <oorel@redhat.com>

* fix: code cleanup

Signed-off-by: Oleksii Orel <oorel@redhat.com>

* feat: add 'change_package_manager.sh' script to switch between Yarn 1 and Yarn 3

Signed-off-by: Oleksii Orel <oorel@redhat.com>

* Update .gitignore

Co-authored-by: Oleksii Kurinnyi <okurinny@redhat.com>

* fix: code cleanup

Signed-off-by: Oleksii Orel <oorel@redhat.com>

---------

Signed-off-by: Oleksii Orel <oorel@redhat.com>
Co-authored-by: Oleksii Kurinnyi <okurinny@redhat.com>
  • Loading branch information
olexii4 and akurinnoy authored Aug 30, 2024
1 parent ca29986 commit 115e48a
Show file tree
Hide file tree
Showing 26 changed files with 178,477 additions and 12,193 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ yarn-error.log
!.yarn/sdks
!.yarn/versions
.pnp.*
.yarn/cache
.yarn/install-state.gz

run/.che-dashboard-pod
run/.custom-resources
run/public-certs

scripts/yarn/tmp
scripts/yarn/old_version/.yarn/cache
scripts/yarn/old_version/node_modules/
875 changes: 875 additions & 0 deletions .yarn/releases/yarn-3.8.3.cjs

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
httpRetry: 3

httpTimeout: 600000

nodeLinker: node-modules

packageExtensions:
"@patternfly/react-icons@*":
dependencies:
tslib: "*"
"@types/react-tooltip@*":
dependencies:
react: "*"
react-dom: "*"
connected-react-router@*:
dependencies:
immutable: "*"
seamless-immutable: "*"
react-pluralize@*:
dependencies:
prop-types: "*"

yarnPath: .yarn/releases/yarn-3.8.3.cjs
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Eclipse Che is a next generation Eclipse IDE. This repository is licensed under
## Requirements

- Node.js `v18.16` and later.
- yarn `v1.20.0` or higher.

**Note**:
Below you can find installation instructions
Expand Down
7 changes: 2 additions & 5 deletions build/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ COPY ${FRONTEND}/package.json /dashboard/${FRONTEND}/
ENV BACKEND=packages/dashboard-backend
COPY ${BACKEND}/package.json /dashboard/${BACKEND}/

COPY .yarn/releases/yarn-*.cjs /dashboard/.yarn/releases/
COPY .yarnrc.yml /dashboard/
WORKDIR /dashboard
RUN yarn install --network-timeout 3600000
COPY packages/ /dashboard/packages
RUN yarn build

# leave only production dependencies
RUN yarn workspace @eclipse-che/dashboard-backend install --production

# Prepare air-gapped resources
COPY scripts/airgap.sh /dashboard/airgap.sh
RUN /dashboard/airgap.sh -i /dashboard/packages/devfile-registry/air-gap/index.json
Expand All @@ -51,11 +50,9 @@ RUN apk --no-cache add curl

ENV FRONTEND_LIB=/dashboard/packages/dashboard-frontend/lib/public
ENV BACKEND_LIB=/dashboard/packages/dashboard-backend/lib
ENV BACKEND_NODE_MODULES=/dashboard/packages/dashboard-backend/node_modules/
ENV DEVFILE_REGISTRY=/dashboard/packages/devfile-registry

COPY --from=builder ${BACKEND_LIB} /backend
COPY --from=builder ${BACKEND_NODE_MODULES} /backend/node_modules
COPY --from=builder ${FRONTEND_LIB} /public
COPY --from=builder ${DEVFILE_REGISTRY} /public/dashboard/devfile-registry

Expand Down
3 changes: 0 additions & 3 deletions build/dockerfiles/brew.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ RUN ln -s "$REMOTE_SOURCES_DIR"/devspaces-images-dashboard/app/devspaces-dashboa
# cachito:yarn step 5: the actual build!
# hadolint ignore=DL3059
RUN yarn build
RUN yarn workspace @eclipse-che/dashboard-backend install --production

# cachito:yarn step 6: cleanup (required only if not using a builder stage)
# RUN rm -rf $REMOTE_SOURCES_DIR
Expand All @@ -55,11 +54,9 @@ RUN \

ENV FRONTEND_LIB=$REMOTE_SOURCES_DIR/devspaces-images-dashboard/app/devspaces-dashboard/packages/dashboard-frontend/lib/public
ENV BACKEND_LIB=$REMOTE_SOURCES_DIR/devspaces-images-dashboard/app/devspaces-dashboard/packages/dashboard-backend/lib
ENV BACKEND_NODE_MODULES=$REMOTE_SOURCES_DIR/devspaces-images-dashboard/app/devspaces-dashboard/packages/dashboard-backend/node_modules/
ENV DEVFILE_REGISTRY=$REMOTE_SOURCES_DIR/devspaces-images-dashboard/app/devspaces-dashboard/packages/devfile-registry

COPY --from=builder ${BACKEND_LIB} /backend
COPY --from=builder ${BACKEND_NODE_MODULES} /backend/node_modules
COPY --from=builder ${FRONTEND_LIB} /public
COPY --from=builder ${DEVFILE_REGISTRY} /public/dashboard/devfile-registry

Expand Down
2 changes: 1 addition & 1 deletion build/dockerfiles/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if [ -n "${RELATED_IMAGES_ENVS}" ]; then
done
fi

start_server="node /backend/server/backend.js --publicFolder /public"
start_server="node --no-deprecation /backend/server/backend.js --publicFolder /public"
$start_server &
wait
echo 'Dashboard backend server is stopped.'
3 changes: 0 additions & 3 deletions build/dockerfiles/rhel.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ COPY . /dashboard/
WORKDIR /dashboard/
RUN npm i -g yarn; yarn install
RUN yarn build
RUN yarn workspace @eclipse-che/dashboard-backend install --production

# https://registry.access.redhat.com/ubi8/nodejs-18
FROM registry.access.redhat.com/ubi8/nodejs-18:1-122
Expand All @@ -32,11 +31,9 @@ RUN \

ENV FRONTEND_LIB=/dashboard/packages/dashboard-frontend/lib/public
ENV BACKEND_LIB=/dashboard/packages/dashboard-backend/lib
ENV BACKEND_NODE_MODULES=/dashboard/packages/dashboard-backend/node_modules/
ENV DEVFILE_REGISTRY=/dashboard/packages/devfile-registry

COPY --from=builder ${BACKEND_LIB} /backend
COPY --from=builder ${BACKEND_NODE_MODULES} /backend/node_modules
COPY --from=builder ${FRONTEND_LIB} /public
COPY --from=builder ${DEVFILE_REGISTRY} /public/dashboard/devfile-registry

Expand Down
2 changes: 1 addition & 1 deletion build/dockerfiles/rhel.entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if [ -n "${RELATED_IMAGES_ENVS}" ]; then
done
fi

start_server="node /backend/server/backend.js --publicFolder /public"
start_server="node --no-deprecation /backend/server/backend.js --publicFolder /public"
$start_server &
wait
echo 'Dashboard backend server is stopped.'
2 changes: 0 additions & 2 deletions build/dockerfiles/skaffold.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ LABEL quay.expires-after=1w

ENV FRONTEND_LIB=../../packages/dashboard-frontend/lib/public
ENV BACKEND_LIB=../../packages/dashboard-backend/lib
ENV BACKEND_NODE_MODULES=../../packages/dashboard-backend/node_modules
ENV DEVFILE_REGISTRY=../../packages/devfile-registry

COPY ${BACKEND_LIB} /backend
COPY ${BACKEND_NODE_MODULES} /backend/node_modules
COPY ${FRONTEND_LIB} /public
COPY ${DEVFILE_REGISTRY} /public/dashboard/devfile-registry

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"npmClient": "yarn",
"stream": true,
"version": "7.91.0-next"
}
}
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,37 @@
"private": true,
"workspaces": {
"packages": [
"packages/*"
],
"nohoist": [
"**/dashboard-backend/**"
"packages/common",
"packages/dashboard-backend",
"packages/dashboard-frontend"
]
},
"bugs": {
"url": "https://github.com/eclipse/che/issues"
},
"homepage": "https://github.com/eclipse-che/che-dashboard",
"engines": {
"yarn": ">=1.22.18",
"node": ">=18"
},
"license": "EPL-2.0",
"scripts": {
"build": "lerna run build --scope=@eclipse-che/dashboard-* --concurrency 1",
"build:dev": "lerna run build:dev --scope=@eclipse-che/dashboard-*",
"prebuild": "lerna run build --scope=@eclipse-che/common",
"build": "yarn prebuild && lerna run build --scope=@eclipse-che/dashboard-\\* --concurrency 1",
"build:dev": "yarn prebuild && lerna run build:dev --scope=@eclipse-che/dashboard-\\*",
"prebuild": "yarn workspace @eclipse-che/common build",
"prebuild:dev": "yarn prebuild",
"frontend:start": "yarn workspace @eclipse-che/dashboard-frontend start",
"start": "${PWD}/run/local-run.sh $@",
"start:prepare": "${PWD}/run/prepare-local-run.sh",
"start:cleanup": "${PWD}/run/revert-local-run.sh",
"license:check": "${PWD}/scripts/container_tool.sh run --rm -t -v ${PWD}/:/workspace/project quay.io/che-incubator/dash-licenses:next --check",
"license:generate": "${PWD}/scripts/container_tool.sh run --rm -t -v ${PWD}/:/workspace/project quay.io/che-incubator/dash-licenses:next",
"test": "lerna run test --stream -- --no-cache $@",
"test:check": "yarn pretest && yarn --cwd packages/dashboard-frontend test --config=jest.config.check.js",
"test": "yarn run pretest && lerna run test --stream -- --no-cache $@",
"test:check": "yarn run pretest && yarn workspace @eclipse-che/dashboard-frontend test --config=jest.config.check.js",
"pretest": "yarn run prebuild",
"test:coverage": "yarn run test -- --coverage",
"format:check": "yarn workspaces run format:check",
"format:check": "lerna run format:check",
"format:fix": "lerna run --stream format:fix",
"lint:check": "yarn workspaces run lint:check",
"lint:check": "lerna run lint:check",
"lint:fix": "lerna run --stream lint:fix",
"patch": "${PWD}/run/patch.sh $@"
},
Expand All @@ -47,9 +45,11 @@
"resolutions": {
"@adobe/css-tools": "^4.3.2",
"axios": "^1.7.4",
"braces": "^3.0.3",
"elliptic": "^6.5.7",
"ip": "^2.0.1",
"undici": "^5.28.3",
"webpack": "^5.94.0"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
"webpack": "^5.94.0",
"ws": "^8.17.1"
}
}
14 changes: 6 additions & 8 deletions packages/dashboard-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"format:fix": "yarn prettier --config .prettierrc --write src/",
"lint:check": "tsc --noEmit && eslint '*/**/*.{js,ts,tsx}'",
"lint:fix": "tsc --noEmit && eslint '*/**/*.{js,ts,tsx}' --fix",
"start:debug": "nodemon --inspect lib/server/backend.js",
"start:debug": "nodemon --inspect --no-deprecation lib/server/backend.js",
"test": "jest --silent=false",
"test:watch": "yarn test --watch"
},
Expand All @@ -27,8 +27,7 @@
"license": "EPL-2.0",
"dependencies": {
"@devfile/api": "2.3.0-1721400636",
"@eclipse-che/che-devworkspace-generator": "7.90.0",
"@eclipse-che/common": "file:../common",
"@eclipse-che/che-devworkspace-generator": "7.90.0-next-4510df7",
"@fastify/cors": "^9.0.1",
"@fastify/error": "^3.4.1",
"@fastify/http-proxy": "^9.5.0",
Expand All @@ -50,7 +49,7 @@
"pino-pretty": "^10.2.0",
"querystring": "^0.2.1",
"reflect-metadata": "^0.1.14",
"ws": "^8.17.0"
"ws": "^8.17.1"
},
"devDependencies": {
"@types/args": "^5.0.0",
Expand All @@ -71,18 +70,17 @@
"file-loader": "^6.2.0",
"jest": "^29.7.0",
"json-schema": "^0.4.0",
"nodemon": "^3.1.0",
"nodemon": "^3.1.4",
"prettier": "^3.2.5",
"source-map-loader": "^5.0.0",
"speed-measure-webpack-plugin": "^1.5.0",
"ts-jest": "^29.1.1",
"ts-loader": "^9.4.4",
"typescript": "^5.1.6",
"webpack": "^5.91.0",
"webpack-bundle-analyzer": "^4.10.0",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-cli": "^5.1.4",
"webpack-merge": "^5.9.0",
"webpack-node-externals": "^3.0.0"
"webpack-merge": "^5.9.0"
},
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions packages/dashboard-backend/src/routes/api/airGapSample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function registerAirGapSampleRoute(instance: FastifyInstance) {
instance.register(async server => {
server.get(
`${baseApiPath}/airgap-sample`,
Object.assign(rateLimitConfig, getSchema({ tags })),
Object.assign({}, rateLimitConfig, getSchema({ tags })),
async () => {
const token = getServiceAccountToken();
const { airGapSampleApi } = getDevWorkspaceClient(token);
Expand All @@ -41,7 +41,7 @@ export function registerAirGapSampleRoute(instance: FastifyInstance) {

server.get(
`${baseApiPath}/airgap-sample/devfile/download`,
Object.assign(rateLimitConfig, getSchema({ tags })),
Object.assign({}, rateLimitConfig, getSchema({ tags })),
async function (request: FastifyRequest, reply: FastifyReply) {
const sampleId = (request.query as { id: string })['id'];
if (!sampleId) {
Expand All @@ -65,7 +65,7 @@ export function registerAirGapSampleRoute(instance: FastifyInstance) {

server.get(
`${baseApiPath}/airgap-sample/project/download`,
Object.assign(rateLimitConfig, getSchema({ tags })),
Object.assign({}, rateLimitConfig, getSchema({ tags })),
async function (request: FastifyRequest, reply: FastifyReply) {
const sampleId = (request.query as { id: string })['id'];
if (!sampleId) {
Expand Down
35 changes: 29 additions & 6 deletions packages/dashboard-backend/webpack.config.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

const path = require('path');
const webpack = require('webpack');
const nodeExternals = require('webpack-node-externals');
const CopyPlugin = require('copy-webpack-plugin');

module.exports = () => {
return {
Expand Down Expand Up @@ -51,15 +51,38 @@ module.exports = () => {
},
},
resolveLoader: {},
plugins: [new webpack.ProgressPlugin()],
plugins: [
new webpack.ProgressPlugin(),
new CopyPlugin({
patterns: [
{
from: path.resolve(
'..',
'..',
'node_modules',
'@fastify/swagger-ui',
'static',
'logo.svg',
),
to: 'server/static',
},
],
}),
new CopyPlugin({
patterns: [
{
from: path.resolve('..', '..', 'node_modules', '@fastify/swagger-ui', 'static'),
to: 'static',
},
],
}),
],
node: {
__dirname: false,
},
externalsPresets: { node: true },
target: 'node',
externals: [
nodeExternals({
allowlist: [/^@devfile\/api/],
}),
'bufferutil', 'utf-8-validate',
],
};
};
Loading

0 comments on commit 115e48a

Please sign in to comment.