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/history-v1
ENV PATH="/overleaf/node_modules/.bin:$PATH"
RUN corepack enable
COPY services/history-v1/install_deps.sh /overleaf/services/history-v1/
RUN chmod 0755 ./install_deps.sh && ./install_deps.sh
@@ -17,7 +19,7 @@ RUN mkdir /buckets && chown node:node /buckets
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
@@ -32,10 +34,10 @@ COPY libraries/stream-utils/package.json /overleaf/libraries/stream-utils/packag
COPY libraries/validation-tools/package.json /overleaf/libraries/validation-tools/package.json
COPY services/history-v1/package.json /overleaf/services/history-v1/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-editor 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 \
@@ -30,7 +30,7 @@ IMAGE_CACHE ?= $(IMAGE_REPO):cache-$(shell cat \
$(MONOREPO)/libraries/validation-tools/package.json \
$(MONOREPO)/services/history-v1/package.json \
$(MONOREPO)/tools/migrations/package.json \
$(MONOREPO)/patches/* \
$(MONOREPO)/.yarn/patches/* \
| sha256sum | cut -d '-' -f1)
DOCKER_COMPOSE_FLAGS ?= -f docker-compose.yml
@@ -57,11 +57,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/history-v1/reports:/overleaf/services/history-v1/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/history-v1/reports:/overleaf/services/history-v1/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/history-v1/reports:/overleaf/services/history-v1/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/history-v1/reports:/overleaf/services/history-v1/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache -w /overleaf $(IMAGE_CI) corepack yarn run --silent
SHELLCHECK_OPTS = \
--shell=bash \
@@ -100,19 +100,19 @@ $(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/
mkdir -p $@
format:
$(RUN_LINTING_MONOREPO) format -- services/history-v1
$(RUN_LINTING_MONOREPO) format services/history-v1
format_ci:
$(RUN_LINTING_CI_MONOREPO) format -- services/history-v1
$(RUN_LINTING_CI_MONOREPO) format services/history-v1
format_fix:
$(RUN_LINTING_MONOREPO) format:fix -- services/history-v1
$(RUN_LINTING_MONOREPO) format:fix services/history-v1
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:
@@ -150,7 +150,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
@@ -163,7 +163,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 @@ history-v1
--env-pass-through=
--esmock-loader=False
--node-version=24.14.1
--package-name=overleaf-editor
--pipeline-owner=44
--public-repo=False
--tsconfig-extra-includes=backup-deletion-app.mjs,backup-verifier-app.mjs,backup-worker-app.mjs,api/**/*,migrations/**/*,storage/**/*
+2 -2
View File
@@ -13,7 +13,7 @@ services:
- ./reports:/overleaf/services/history-v1/reports
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
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
@@ -77,7 +77,7 @@ services:
condition: service_healthy
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
@@ -15,6 +15,9 @@ services:
- .:/overleaf/services/history-v1
- ../../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
working_dir: /overleaf/services/history-v1
@@ -30,7 +33,7 @@ services:
ANALYTICS_QUEUES_REDIS_HOST: redis_test
ANALYTICS_QUEUES_BQ_SINK_REDIS_HOST: redis_test
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:
@@ -47,6 +50,9 @@ services:
- .:/overleaf/services/history-v1
- ../../node_modules:/overleaf/node_modules
- ../../libraries:/overleaf/libraries
- ../../package.json:/overleaf/package.json
- ../../.yarnrc.yml:/overleaf/.yarnrc.yml
- ../../yarn.lock:/overleaf/yarn.lock
- minio-certs:/certs
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
- ../../tools/migrations:/overleaf/tools/migrations
@@ -91,7 +97,7 @@ services:
gcs:
condition: service_healthy
entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 --
command: npm run --silent test:acceptance
command: corepack yarn run --silent test:acceptance
redis_test:
image: redis:7.4.8
+14 -14
View File
@@ -7,17 +7,17 @@
"private": true,
"dependencies": {
"@google-cloud/secret-manager": "^5.6.0",
"@overleaf/fetch-utils": "*",
"@overleaf/logger": "*",
"@overleaf/metrics": "*",
"@overleaf/mongo-utils": "*",
"@overleaf/o-error": "*",
"@overleaf/object-persistor": "*",
"@overleaf/promise-utils": "*",
"@overleaf/redis-wrapper": "*",
"@overleaf/settings": "*",
"@overleaf/fetch-utils": "workspace:*",
"@overleaf/logger": "workspace:*",
"@overleaf/metrics": "workspace:*",
"@overleaf/mongo-utils": "workspace:*",
"@overleaf/o-error": "workspace:*",
"@overleaf/object-persistor": "workspace:*",
"@overleaf/promise-utils": "workspace:*",
"@overleaf/redis-wrapper": "workspace:*",
"@overleaf/settings": "workspace:*",
"@overleaf/stream-utils": "^0.1.0",
"@overleaf/validation-tools": "*",
"@overleaf/validation-tools": "workspace:*",
"archiver": "^5.3.0",
"basic-auth": "^2.0.1",
"bluebird": "^3.7.2",
@@ -36,7 +36,7 @@
"knex": "^2.4.0",
"lodash": "^4.17.19",
"mongodb": "6.12.0",
"overleaf-editor-core": "*",
"overleaf-editor-core": "workspace:*",
"p-limit": "^6.2.0",
"p-queue": "^8.1.0",
"pg": "^8.7.1",
@@ -47,7 +47,7 @@
"utf-8-validate": "^5.0.4"
},
"devDependencies": {
"@overleaf/migrations": "*",
"@overleaf/migrations": "workspace:*",
"benny": "^3.7.1",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",
@@ -64,8 +64,8 @@
"start": "node app.js",
"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 .",
"test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP",
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit": "yarn run test:unit:_run -- --grep=$MOCHA_GREP",
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$MOCHA_GREP",
"test:unit:_run": "mocha --recursive --exit $@ test/unit/js",
"test:acceptance:_run": "mocha --recursive --timeout 15000 --exit --retries=$RETRIES $@ test/acceptance/js",
"nodemon": "node --watch app.js",