mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
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:
committed by
Copybot
parent
ed0fb0110a
commit
0d64a88a46
@@ -5,6 +5,8 @@
|
||||
FROM node:24.14.1 AS base
|
||||
|
||||
WORKDIR /overleaf/services/filestore
|
||||
ENV PATH="/overleaf/node_modules/.bin:$PATH"
|
||||
RUN corepack enable
|
||||
COPY services/filestore/install_deps.sh /overleaf/services/filestore/
|
||||
RUN chmod 0755 ./install_deps.sh && ./install_deps.sh
|
||||
|
||||
@@ -14,7 +16,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,9 +25,9 @@ COPY libraries/object-persistor/package.json /overleaf/libraries/object-persisto
|
||||
COPY libraries/settings/package.json /overleaf/libraries/settings/package.json
|
||||
COPY libraries/stream-utils/package.json /overleaf/libraries/stream-utils/package.json
|
||||
COPY services/filestore/package.json /overleaf/services/filestore/package.json
|
||||
COPY patches/ /overleaf/patches/
|
||||
COPY .yarn/patches/ /overleaf/.yarn/patches/
|
||||
|
||||
RUN cd /overleaf && npm ci --quiet
|
||||
RUN cd /overleaf && yarn workspaces focus @overleaf/filestore overleaf
|
||||
COPY libraries/fetch-utils/ /overleaf/libraries/fetch-utils/
|
||||
COPY libraries/logger/ /overleaf/libraries/logger/
|
||||
COPY libraries/metrics/ /overleaf/libraries/metrics/
|
||||
|
||||
+12
-12
@@ -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 \
|
||||
@@ -24,7 +24,7 @@ IMAGE_CACHE ?= $(IMAGE_REPO):cache-$(shell cat \
|
||||
$(MONOREPO)/libraries/settings/package.json \
|
||||
$(MONOREPO)/libraries/stream-utils/package.json \
|
||||
$(MONOREPO)/services/filestore/package.json \
|
||||
$(MONOREPO)/patches/* \
|
||||
$(MONOREPO)/.yarn/patches/* \
|
||||
| sha256sum | cut -d '-' -f1)
|
||||
|
||||
DOCKER_COMPOSE_FLAGS ?= -f docker-compose.yml
|
||||
@@ -52,11 +52,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/filestore/reports:/overleaf/services/filestore/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/filestore/reports:/overleaf/services/filestore/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/filestore/reports:/overleaf/services/filestore/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/filestore/reports:/overleaf/services/filestore/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache -w /overleaf $(IMAGE_CI) corepack yarn run --silent
|
||||
|
||||
SHELLCHECK_OPTS = \
|
||||
--shell=bash \
|
||||
@@ -95,19 +95,19 @@ $(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/
|
||||
mkdir -p $@
|
||||
|
||||
format:
|
||||
$(RUN_LINTING_MONOREPO) format -- services/filestore
|
||||
$(RUN_LINTING_MONOREPO) format services/filestore
|
||||
|
||||
format_ci:
|
||||
$(RUN_LINTING_CI_MONOREPO) format -- services/filestore
|
||||
$(RUN_LINTING_CI_MONOREPO) format services/filestore
|
||||
|
||||
format_fix:
|
||||
$(RUN_LINTING_MONOREPO) format:fix -- services/filestore
|
||||
$(RUN_LINTING_MONOREPO) format:fix services/filestore
|
||||
|
||||
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:
|
||||
@@ -145,7 +145,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
|
||||
@@ -158,7 +158,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,10 +1,11 @@
|
||||
filestore
|
||||
--data-dirs=uploads,template_files
|
||||
--dependencies=s3,gcs
|
||||
--env-add=ENABLE_CONVERSIONS="true",USE_PROM_METRICS="true",AWS_S3_USER_FILES_STORAGE_CLASS=REDUCED_REDUNDANCY,AWS_S3_USER_FILES_BUCKET_NAME=fake-user-files,AWS_S3_USER_FILES_DEK_BUCKET_NAME=fake-user-files-dek,AWS_S3_TEMPLATE_FILES_BUCKET_NAME=fake-template-files,GCS_USER_FILES_BUCKET_NAME=fake-gcs-user-files,GCS_TEMPLATE_FILES_BUCKET_NAME=fake-gcs-template-files
|
||||
--env-add=ENABLE_CONVERSIONS=true,USE_PROM_METRICS=true,AWS_S3_USER_FILES_STORAGE_CLASS=REDUCED_REDUNDANCY,AWS_S3_USER_FILES_BUCKET_NAME=fake-user-files,AWS_S3_USER_FILES_DEK_BUCKET_NAME=fake-user-files-dek,AWS_S3_TEMPLATE_FILES_BUCKET_NAME=fake-template-files,GCS_USER_FILES_BUCKET_NAME=fake-gcs-user-files,GCS_TEMPLATE_FILES_BUCKET_NAME=fake-gcs-template-files
|
||||
--env-pass-through=
|
||||
--esmock-loader=False
|
||||
--node-version=24.14.1
|
||||
--package-name=@overleaf/filestore
|
||||
--pipeline-owner=32
|
||||
--public-repo=True
|
||||
--test-acceptance-shards=SHARD_01_,SHARD_02_,SHARD_03_
|
||||
|
||||
@@ -12,7 +12,7 @@ services:
|
||||
volumes:
|
||||
- ./reports:/overleaf/services/filestore/reports
|
||||
- ../../tsconfig.backend.json:/overleaf/tsconfig.backend.json
|
||||
command: npm run test:unit:_run
|
||||
command: yarn run test:unit:_run
|
||||
environment:
|
||||
CI:
|
||||
MONGO_CONNECTION_STRING: mongodb://mongo/test-overleaf
|
||||
@@ -41,8 +41,8 @@ services:
|
||||
MOCHA_GREP: ${MOCHA_GREP}
|
||||
NODE_ENV: test
|
||||
NODE_OPTIONS: "--unhandled-rejections=strict"
|
||||
ENABLE_CONVERSIONS: "true"
|
||||
USE_PROM_METRICS: "true"
|
||||
ENABLE_CONVERSIONS: true
|
||||
USE_PROM_METRICS: true
|
||||
AWS_S3_USER_FILES_STORAGE_CLASS: REDUCED_REDUNDANCY
|
||||
AWS_S3_USER_FILES_BUCKET_NAME: fake-user-files
|
||||
AWS_S3_USER_FILES_DEK_BUCKET_NAME: fake-user-files-dek
|
||||
@@ -62,7 +62,7 @@ services:
|
||||
gcs:
|
||||
condition: service_healthy
|
||||
user: node
|
||||
command: npm run test:acceptance
|
||||
command: yarn run test:acceptance
|
||||
|
||||
tar:
|
||||
build: .
|
||||
|
||||
@@ -15,6 +15,9 @@ services:
|
||||
- .:/overleaf/services/filestore
|
||||
- ../../node_modules:/overleaf/node_modules
|
||||
- ../../libraries:/overleaf/libraries
|
||||
- ../../package.json:/overleaf/package.json
|
||||
- ../../.yarnrc.yml:/overleaf/.yarnrc.yml
|
||||
- ../../yarn.lock:/overleaf/yarn.lock
|
||||
- ../../tsconfig.backend.json:/overleaf/tsconfig.backend.json
|
||||
working_dir: /overleaf/services/filestore
|
||||
environment:
|
||||
@@ -23,7 +26,7 @@ services:
|
||||
MONGO_CONNECTION_STRING: mongodb://mongo/test-overleaf
|
||||
NODE_ENV: test
|
||||
NODE_OPTIONS: "--unhandled-rejections=strict"
|
||||
command: npm run --silent test:unit
|
||||
command: corepack yarn run --silent test:unit
|
||||
user: node
|
||||
|
||||
test_acceptance:
|
||||
@@ -35,6 +38,9 @@ services:
|
||||
- .:/overleaf/services/filestore
|
||||
- ../../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
|
||||
working_dir: /overleaf/services/filestore
|
||||
environment:
|
||||
@@ -55,8 +61,8 @@ services:
|
||||
LOG_LEVEL: ${LOG_LEVEL:-}
|
||||
NODE_ENV: test
|
||||
NODE_OPTIONS: "--unhandled-rejections=strict"
|
||||
ENABLE_CONVERSIONS: "true"
|
||||
USE_PROM_METRICS: "true"
|
||||
ENABLE_CONVERSIONS: true
|
||||
USE_PROM_METRICS: true
|
||||
AWS_S3_USER_FILES_STORAGE_CLASS: REDUCED_REDUNDANCY
|
||||
AWS_S3_USER_FILES_BUCKET_NAME: fake-user-files
|
||||
AWS_S3_USER_FILES_DEK_BUCKET_NAME: fake-user-files-dek
|
||||
@@ -73,7 +79,7 @@ services:
|
||||
condition: service_completed_successfully
|
||||
gcs:
|
||||
condition: service_healthy
|
||||
command: npm run --silent test:acceptance
|
||||
command: corepack yarn run --silent test:acceptance
|
||||
|
||||
certs:
|
||||
build:
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test:acceptance:run": "mocha --recursive --timeout 15000 $@ test/acceptance/js",
|
||||
"test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP",
|
||||
"test:acceptance": "yarn run test:acceptance:_run -- --grep=$MOCHA_GREP",
|
||||
"test:unit:run": "mocha --recursive $@ test/unit/js",
|
||||
"test:unit": "npm run test:unit:_run",
|
||||
"test:unit": "yarn run test:unit:_run",
|
||||
"start": "node app.js",
|
||||
"nodemon": "node --watch app.js",
|
||||
"lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --max-warnings 0 --format unix .",
|
||||
@@ -19,11 +19,11 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.994.0",
|
||||
"@overleaf/logger": "*",
|
||||
"@overleaf/metrics": "*",
|
||||
"@overleaf/o-error": "*",
|
||||
"@overleaf/object-persistor": "*",
|
||||
"@overleaf/settings": "*",
|
||||
"@overleaf/logger": "workspace:*",
|
||||
"@overleaf/metrics": "workspace:*",
|
||||
"@overleaf/o-error": "workspace:*",
|
||||
"@overleaf/object-persistor": "workspace:*",
|
||||
"@overleaf/settings": "workspace:*",
|
||||
"@overleaf/stream-utils": "^0.1.0",
|
||||
"body-parser": "1.20.4",
|
||||
"bunyan": "^1.8.15",
|
||||
|
||||
@@ -4,7 +4,32 @@ import mongodb from 'mongodb'
|
||||
import sinonChai from 'sinon-chai'
|
||||
import chaiAsPromised from 'chai-as-promised'
|
||||
|
||||
// Workaround: vitest's built-in chai plugins register spy-related properties
|
||||
// (e.g. callCount) as getter-only via addChainableMethod. sinon-chai then tries
|
||||
// to overwrite them via addMethod (plain property assignment), which fails.
|
||||
// Pre-delete the conflicting getter-only properties so the assignment succeeds.
|
||||
const sinonChaiMethodProps = [
|
||||
'callCount',
|
||||
'calledBefore',
|
||||
'calledAfter',
|
||||
'calledImmediatelyBefore',
|
||||
'calledImmediatelyAfter',
|
||||
'calledOn',
|
||||
'calledWith',
|
||||
'calledOnceWith',
|
||||
'calledWithExactly',
|
||||
'calledOnceWithExactly',
|
||||
'calledWithMatch',
|
||||
'returned',
|
||||
'thrown',
|
||||
]
|
||||
for (const name of sinonChaiMethodProps) {
|
||||
if (Object.getOwnPropertyDescriptor(chai.Assertion.prototype, name)?.get) {
|
||||
delete chai.Assertion.prototype[name]
|
||||
}
|
||||
}
|
||||
chai.use(sinonChai)
|
||||
|
||||
chai.use(chaiAsPromised)
|
||||
|
||||
// ensure every ObjectId has the id string as a property for correct comparisons
|
||||
|
||||
Reference in New Issue
Block a user