Yarn 4 Migration (#32253)

Migrates the Overleaf monorepo package manager from npm (v11) to Yarn 4 (v4.9.1) using node-modules linker mode.

GitOrigin-RevId: 50d32ab01955c15e29679eff9e9e9cfb897fab2d
This commit is contained in:
Anna Claire Fields
2026-04-28 08:52:37 +00:00
committed by Copybot
parent ed0fb0110a
commit 0d64a88a46
137 changed files with 39227 additions and 538 deletions
+5 -3
View File
@@ -5,6 +5,8 @@
FROM node:24.14.1 AS base
WORKDIR /overleaf/services/notifications
ENV PATH="/overleaf/node_modules/.bin:$PATH"
RUN corepack enable
# Google Cloud Storage needs a writable $HOME/.config for resumable uploads
# (see https://googleapis.dev/nodejs/storage/latest/File.html#createWriteStream)
@@ -12,7 +14,7 @@ RUN mkdir /home/node/.config && chown node:node /home/node/.config
FROM base AS app
COPY package.json package-lock.json /overleaf/
COPY package.json yarn.lock .yarnrc.yml /overleaf/
COPY libraries/fetch-utils/package.json /overleaf/libraries/fetch-utils/package.json
COPY libraries/logger/package.json /overleaf/libraries/logger/package.json
COPY libraries/metrics/package.json /overleaf/libraries/metrics/package.json
@@ -23,10 +25,10 @@ COPY libraries/settings/package.json /overleaf/libraries/settings/package.json
COPY libraries/validation-tools/package.json /overleaf/libraries/validation-tools/package.json
COPY services/notifications/package.json /overleaf/services/notifications/package.json
COPY tools/migrations/package.json /overleaf/tools/migrations/package.json
COPY patches/ /overleaf/patches/
COPY .yarn/patches/ /overleaf/.yarn/patches/
COPY tools/migrations/ /overleaf/tools/migrations/
RUN cd /overleaf && npm ci --quiet
RUN cd /overleaf && yarn workspaces focus @overleaf/notifications overleaf
COPY libraries/fetch-utils/ /overleaf/libraries/fetch-utils/
COPY libraries/logger/ /overleaf/libraries/logger/
COPY libraries/metrics/ /overleaf/libraries/metrics/
+12 -12
View File
@@ -15,7 +15,7 @@ IMAGE_REPO ?= us-east1-docker.pkg.dev/overleaf-ops/ol-docker/$(PROJECT_NAME)
IMAGE_REPO_FINAL ?= $(IMAGE_REPO):$(BRANCH_NAME_TAG_SAFE)-$(BUILD_NUMBER)
IMAGE_CACHE ?= $(IMAGE_REPO):cache-$(shell cat \
$(MONOREPO)/package.json \
$(MONOREPO)/package-lock.json \
$(MONOREPO)/yarn.lock \
$(MONOREPO)/libraries/fetch-utils/package.json \
$(MONOREPO)/libraries/logger/package.json \
$(MONOREPO)/libraries/metrics/package.json \
@@ -26,7 +26,7 @@ IMAGE_CACHE ?= $(IMAGE_REPO):cache-$(shell cat \
$(MONOREPO)/libraries/validation-tools/package.json \
$(MONOREPO)/services/notifications/package.json \
$(MONOREPO)/tools/migrations/package.json \
$(MONOREPO)/patches/* \
$(MONOREPO)/.yarn/patches/* \
| sha256sum | cut -d '-' -f1)
DOCKER_COMPOSE_FLAGS ?= -f docker-compose.yml
@@ -53,11 +53,11 @@ clean:
# Run the linting commands in the scope of the monorepo.
# Eslint and prettier (plus some configs) are on the root.
RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) --user node node:24.14.1 npm run --silent
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) --user node node:24.14.1 npm run --silent
RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) -e PATH=$(MONOREPO)/node_modules/.bin:$$PATH --user node node:24.14.1 corepack yarn run --silent
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) -e PATH=$(MONOREPO)/node_modules/.bin:$$PATH --user node node:24.14.1 corepack yarn run --silent
RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/notifications/reports:/overleaf/services/notifications/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache $(IMAGE_CI) npm run --silent
RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/notifications/reports:/overleaf/services/notifications/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache -w /overleaf $(IMAGE_CI) npm run --silent
RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/notifications/reports:/overleaf/services/notifications/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache $(IMAGE_CI) corepack yarn run --silent
RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/notifications/reports:/overleaf/services/notifications/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache -w /overleaf $(IMAGE_CI) corepack yarn run --silent
SHELLCHECK_OPTS = \
--shell=bash \
@@ -96,19 +96,19 @@ $(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/
mkdir -p $@
format:
$(RUN_LINTING_MONOREPO) format -- services/notifications
$(RUN_LINTING_MONOREPO) format services/notifications
format_ci:
$(RUN_LINTING_CI_MONOREPO) format -- services/notifications
$(RUN_LINTING_CI_MONOREPO) format services/notifications
format_fix:
$(RUN_LINTING_MONOREPO) format:fix -- services/notifications
$(RUN_LINTING_MONOREPO) format:fix services/notifications
lint:
$(RUN_LINTING) lint
lint_ci:
-$(RUN_LINTING_CI) lint -- --format json --output-file reports/eslint.json
-$(RUN_LINTING_CI) lint --format json --output-file reports/eslint.json
sed -i 's_"filePath":"/overleaf_"filePath":"$(MONOREPO)_g' reports/eslint.json
lint_fix:
@@ -146,7 +146,7 @@ endif
test_acceptance_run_debug:
ifneq (,$(wildcard test/acceptance))
$(DOCKER_COMPOSE_TEST_ACCEPTANCE) run -p 127.0.0.9:19999:19999 --rm test_acceptance npm run test:acceptance -- --inspect=0.0.0.0:19999 --inspect-brk
$(DOCKER_COMPOSE_TEST_ACCEPTANCE) run -p 127.0.0.9:19999:19999 --rm test_acceptance corepack yarn run --inspect=0.0.0.0:19999 --inspect-brk test:acceptance
endif
test_clean: test_acceptance_clean
@@ -159,7 +159,7 @@ ifneq (,$(wildcard test/acceptance/js/scripts/pre-run))
endif
benchmarks:
$(DOCKER_COMPOSE_TEST_ACCEPTANCE) run --rm test_acceptance npm run benchmarks
$(DOCKER_COMPOSE_TEST_ACCEPTANCE) run --rm test_acceptance corepack yarn run benchmarks
build:
docker build \
+1
View File
@@ -4,6 +4,7 @@ notifications
--env-pass-through=
--esmock-loader=False
--node-version=24.14.1
--package-name=@overleaf/notifications
--pipeline-owner=32
--public-repo=True
--test-acceptance-vitest=True
+2 -2
View File
@@ -11,7 +11,7 @@ services:
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
- ../../tsconfig.backend.json:/overleaf/tsconfig.backend.json
entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 --
command: npm run test:unit:_run
command: yarn run test:unit:_run
environment:
CI:
MONGO_CONNECTION_STRING: mongodb://mongo/test-overleaf
@@ -42,7 +42,7 @@ services:
condition: service_started
user: node
entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 --
command: npm run test:acceptance
command: yarn run test:acceptance
tar:
build: .
+8 -2
View File
@@ -9,6 +9,9 @@ services:
- .:/overleaf/services/notifications
- ../../node_modules:/overleaf/node_modules
- ../../libraries:/overleaf/libraries
- ../../package.json:/overleaf/package.json
- ../../.yarnrc.yml:/overleaf/.yarnrc.yml
- ../../yarn.lock:/overleaf/yarn.lock
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
- ../../tools/migrations:/overleaf/tools/migrations
- ../../tsconfig.backend.json:/overleaf/tsconfig.backend.json
@@ -20,7 +23,7 @@ services:
NODE_ENV: test
NODE_OPTIONS: "--unhandled-rejections=strict"
entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 --
command: npm run --silent test:unit
command: corepack yarn run --silent test:unit
user: node
depends_on:
mongo:
@@ -32,6 +35,9 @@ services:
- .:/overleaf/services/notifications
- ../../node_modules:/overleaf/node_modules
- ../../libraries:/overleaf/libraries
- ../../package.json:/overleaf/package.json
- ../../.yarnrc.yml:/overleaf/.yarnrc.yml
- ../../yarn.lock:/overleaf/yarn.lock
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
- ../../tools/migrations:/overleaf/tools/migrations
- ../../tsconfig.backend.json:/overleaf/tsconfig.backend.json
@@ -49,7 +55,7 @@ services:
mongo:
condition: service_started
entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 --
command: npm run --silent test:acceptance
command: corepack yarn run --silent test:acceptance
mongo:
image: mongo:8.0.11
+11 -11
View File
@@ -7,9 +7,9 @@
"scripts": {
"start": "node app.ts",
"test:acceptance:_run": "vitest --config ./vitest.config.acceptance.cjs",
"test:acceptance": "npm run test:acceptance:_run",
"test:acceptance": "yarn run test:acceptance:_run",
"test:unit:_run": "vitest --config ./vitest.config.unit.cjs",
"test:unit": "npm run test:unit:_run",
"test:unit": "yarn run test:unit:_run",
"lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --max-warnings 0 --format unix .",
"lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix .",
"types:check": "tsc --noEmit",
@@ -18,14 +18,14 @@
"author": "",
"license": "ISC",
"dependencies": {
"@overleaf/fetch-utils": "*",
"@overleaf/logger": "*",
"@overleaf/metrics": "*",
"@overleaf/mongo-utils": "*",
"@overleaf/o-error": "*",
"@overleaf/settings": "*",
"@overleaf/promise-utils": "*",
"@overleaf/validation-tools": "*",
"@overleaf/fetch-utils": "workspace:*",
"@overleaf/logger": "workspace:*",
"@overleaf/metrics": "workspace:*",
"@overleaf/mongo-utils": "workspace:*",
"@overleaf/o-error": "workspace:*",
"@overleaf/promise-utils": "workspace:*",
"@overleaf/settings": "workspace:*",
"@overleaf/validation-tools": "workspace:*",
"async": "^3.2.5",
"body-parser": "1.20.4",
"bunyan": "^1.8.15",
@@ -36,7 +36,7 @@
"zod-validation-error": "^4.0.1"
},
"devDependencies": {
"@overleaf/migrations": "*",
"@overleaf/migrations": "workspace:*",
"@types/method-override": "^3.0.0",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",