diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 9c0577106e..37491ab1ec 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -4,7 +4,6 @@ about: Report a bug title: '' labels: type:bug assignees: '' - --- - - ## Steps to Reproduce + @@ -31,23 +29,28 @@ Note: If you are using www.overleaf.com and have a problem, 3. ## Expected Behaviour + ## Observed Behaviour + ## Context + ## Technical Info + -* URL: -* Browser Name and version: -* Operating System and version (desktop or mobile): -* Signed in as: -* Project and/or file: +- URL: +- Browser Name and version: +- Operating System and version (desktop or mobile): +- Signed in as: +- Project and/or file: ## Analysis + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0e533f8fa9..d9cc6a611d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,10 +1,10 @@ ## Description + - ## Related issues / Pull Requests - + ## Contributor Agreement diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5217640350..774f860cc5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,11 +1,9 @@ -Contributing to Overleaf -========================== +# Contributing to Overleaf Thank you for reading this! If you'd like to report a bug or join in the development of Overleaf, then here are some notes on how to do that. -Reporting bugs and opening issues ---------------------------------- +## Reporting bugs and opening issues If you'd like to report a bug or open an issue, please **[check if there is an existing issue](https://github.com/overleaf/overleaf/issues).** If there is then please add any more information that you have, or give it a 👍. @@ -16,8 +14,7 @@ If you can include a screenshot for front end issues that is very helpful. **Note**: If you are using [www.overleaf.com](www.overleaf.com) and have a problem, or if you would like to request a new feature, please contact the Support team at support@overleaf.com. Raise an issue here only to report bugs in the Community Edition release of Overleaf. -Pull Requests -------------- +## Pull Requests See [our wiki](https://github.com/overleaf/overleaf/wiki) for how to manage the Overleaf development environment and for our developer guidelines. @@ -28,13 +25,11 @@ to get your changes merged into Overleaf. If you're looking for something to work on, have a look at the [open issues](https://github.com/overleaf/overleaf/issues). -Security --------- +## Security Please see [our security policy](https://github.com/overleaf/overleaf/security/policy) if you would like to report a potential security vulnerability. -Contributor License Agreement ------------------------------ +## Contributor License Agreement Before we can accept any contributions of code, we need you to agree to our [Contributor License Agreement](https://docs.google.com/forms/d/e/1FAIpQLSef79XH3mb7yIiMzZw-yALEegS-wyFetvjTiNBfZvf_IHD2KA/viewform?usp=sf_link). diff --git a/README.md b/README.md index 524a831262..192f8b7877 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,6 @@ in which to run the Overleaf services. Baseimage uses the `runit` service manager to manage services, and we add our init-scripts from the `server-ce/runit` folder. - ## Contributing Please see the [CONTRIBUTING](CONTRIBUTING.md) file for information on contributing to the development of Overleaf. diff --git a/develop/docker-compose.yml b/develop/docker-compose.yml index db5be83a28..3beac219b7 100644 --- a/develop/docker-compose.yml +++ b/develop/docker-compose.yml @@ -63,8 +63,8 @@ services: dockerfile: services/filestore/Dockerfile env_file: - dev.env -# environment: -# - ENABLE_CONVERSIONS=true + # environment: + # - ENABLE_CONVERSIONS=true volumes: - filestore-public-files:/overleaf/services/filestore/public_files - filestore-template-files:/overleaf/services/filestore/template_files @@ -75,7 +75,7 @@ services: context: .. dockerfile: services/history-v1/Dockerfile env_file: - - dev.env + - dev.env environment: OVERLEAF_EDITOR_ANALYTICS_BUCKET: "/buckets/analytics" OVERLEAF_EDITOR_BLOBS_BUCKET: "/buckets/blobs" @@ -84,7 +84,7 @@ services: OVERLEAF_EDITOR_ZIPS_BUCKET: "/buckets/zips" PERSISTOR_BACKEND: fs volumes: - - history-v1-buckets:/buckets + - history-v1-buckets:/buckets mongo: image: mongo:6.0 @@ -114,7 +114,7 @@ services: context: .. dockerfile: services/project-history/Dockerfile env_file: - - dev.env + - dev.env real-time: build: @@ -166,7 +166,8 @@ services: context: .. dockerfile: services/web/Dockerfile target: webpack - command: ["npx", "webpack", "serve", "--config", "webpack.config.dev-env.js"] + command: + ["npx", "webpack", "serve", "--config", "webpack.config.dev-env.js"] ports: - "127.0.0.1:80:3808" volumes: diff --git a/docker-compose.debug.yml b/docker-compose.debug.yml index cf87fbf023..b6530df019 100644 --- a/docker-compose.debug.yml +++ b/docker-compose.debug.yml @@ -1,23 +1,23 @@ -version: '2.2' +version: "2.2" services: - sharelatex: - ports: - - 30000:30000 - - 30150:30150 - - 30120:30120 - - 30050:30050 - - 30420:30420 - - 30030:30030 - - 30160:30160 - - 30360:30360 - - 30130:30130 - - 30100:30100 - - 30540:30540 - - 30640:30640 - - 40000:40000 + sharelatex: + ports: + - 30000:30000 + - 30150:30150 + - 30120:30120 + - 30050:30050 + - 30420:30420 + - 30030:30030 + - 30160:30160 + - 30360:30360 + - 30130:30130 + - 30100:30100 + - 30540:30540 + - 30640:30640 + - 40000:40000 - # Server Pro - - 30070:30070 - - 30400:30400 - environment: - DEBUG_NODE: 'true' + # Server Pro + - 30070:30070 + - 30400:30400 + environment: + DEBUG_NODE: "true" diff --git a/docker-compose.yml b/docker-compose.yml index c60a4d4116..93deef25cc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,151 +1,149 @@ services: - sharelatex: - restart: always - # Server Pro users: - # image: quay.io/sharelatex/sharelatex-pro - image: sharelatex/sharelatex - container_name: sharelatex - depends_on: - mongo: - condition: service_healthy - redis: - condition: service_started - ports: - - 80:80 - stop_grace_period: 60s - volumes: - - ~/sharelatex_data:/var/lib/overleaf - ######################################################################## - #### Server Pro: Uncomment the following line to mount the docker #### - #### socket, required for Sibling Containers to work #### - ######################################################################## - # - /var/run/docker.sock:/var/run/docker.sock - environment: + sharelatex: + restart: always + # Server Pro users: + # image: quay.io/sharelatex/sharelatex-pro + image: sharelatex/sharelatex + container_name: sharelatex + depends_on: + mongo: + condition: service_healthy + redis: + condition: service_started + ports: + - 80:80 + stop_grace_period: 60s + volumes: + - ~/sharelatex_data:/var/lib/overleaf + ######################################################################## + #### Server Pro: Uncomment the following line to mount the docker #### + #### socket, required for Sibling Containers to work #### + ######################################################################## + # - /var/run/docker.sock:/var/run/docker.sock + environment: + OVERLEAF_APP_NAME: Overleaf Community Edition - OVERLEAF_APP_NAME: Overleaf Community Edition + OVERLEAF_MONGO_URL: mongodb://mongo/sharelatex - OVERLEAF_MONGO_URL: mongodb://mongo/sharelatex + # Same property, unfortunately with different names in + # different locations + OVERLEAF_REDIS_HOST: redis + REDIS_HOST: redis - # Same property, unfortunately with different names in - # different locations - OVERLEAF_REDIS_HOST: redis - REDIS_HOST: redis + ENABLED_LINKED_FILE_TYPES: "project_file,project_output_file" - ENABLED_LINKED_FILE_TYPES: 'project_file,project_output_file' + # Enables Thumbnail generation using ImageMagick + ENABLE_CONVERSIONS: "true" - # Enables Thumbnail generation using ImageMagick - ENABLE_CONVERSIONS: 'true' + # Disables email confirmation requirement + EMAIL_CONFIRMATION_DISABLED: "true" - # Disables email confirmation requirement - EMAIL_CONFIRMATION_DISABLED: 'true' + ## Set for SSL via nginx-proxy + #VIRTUAL_HOST: 103.112.212.22 - ## Set for SSL via nginx-proxy - #VIRTUAL_HOST: 103.112.212.22 + # OVERLEAF_SITE_URL: http://overleaf.example.com + # OVERLEAF_NAV_TITLE: Overleaf Community Edition + # OVERLEAF_HEADER_IMAGE_URL: http://example.com/mylogo.png + # OVERLEAF_ADMIN_EMAIL: support@it.com - # OVERLEAF_SITE_URL: http://overleaf.example.com - # OVERLEAF_NAV_TITLE: Overleaf Community Edition - # OVERLEAF_HEADER_IMAGE_URL: http://example.com/mylogo.png - # OVERLEAF_ADMIN_EMAIL: support@it.com + # OVERLEAF_LEFT_FOOTER: '[{"text": "Another page I want to link to can be found here"} ]' + # OVERLEAF_RIGHT_FOOTER: '[{"text": "Hello I am on the Right"} ]' - # OVERLEAF_LEFT_FOOTER: '[{"text": "Another page I want to link to can be found here"} ]' - # OVERLEAF_RIGHT_FOOTER: '[{"text": "Hello I am on the Right"} ]' + # OVERLEAF_EMAIL_FROM_ADDRESS: "hello@example.com" - # OVERLEAF_EMAIL_FROM_ADDRESS: "hello@example.com" + # OVERLEAF_EMAIL_AWS_SES_ACCESS_KEY_ID: + # OVERLEAF_EMAIL_AWS_SES_SECRET_KEY: - # OVERLEAF_EMAIL_AWS_SES_ACCESS_KEY_ID: - # OVERLEAF_EMAIL_AWS_SES_SECRET_KEY: + # OVERLEAF_EMAIL_SMTP_HOST: smtp.example.com + # OVERLEAF_EMAIL_SMTP_PORT: 587 + # OVERLEAF_EMAIL_SMTP_SECURE: false + # OVERLEAF_EMAIL_SMTP_USER: + # OVERLEAF_EMAIL_SMTP_PASS: + # OVERLEAF_EMAIL_SMTP_TLS_REJECT_UNAUTH: true + # OVERLEAF_EMAIL_SMTP_IGNORE_TLS: false + # OVERLEAF_EMAIL_SMTP_NAME: '127.0.0.1' + # OVERLEAF_EMAIL_SMTP_LOGGER: true + # OVERLEAF_CUSTOM_EMAIL_FOOTER: "This system is run by department x" - # OVERLEAF_EMAIL_SMTP_HOST: smtp.example.com - # OVERLEAF_EMAIL_SMTP_PORT: 587 - # OVERLEAF_EMAIL_SMTP_SECURE: false - # OVERLEAF_EMAIL_SMTP_USER: - # OVERLEAF_EMAIL_SMTP_PASS: - # OVERLEAF_EMAIL_SMTP_TLS_REJECT_UNAUTH: true - # OVERLEAF_EMAIL_SMTP_IGNORE_TLS: false - # OVERLEAF_EMAIL_SMTP_NAME: '127.0.0.1' - # OVERLEAF_EMAIL_SMTP_LOGGER: true - # OVERLEAF_CUSTOM_EMAIL_FOOTER: "This system is run by department x" + # ENABLE_CRON_RESOURCE_DELETION: true - # ENABLE_CRON_RESOURCE_DELETION: true + ################ + ## Server Pro ## + ################ - ################ - ## Server Pro ## - ################ + ## The Community Edition is intended for use in environments where all users are trusted and is not appropriate for + ## scenarios where isolation of users is required. Sandboxed Compiles are not available in the Community Edition, + ## so the following environment variables must be commented out to avoid compile issues. + ## + ## Sandboxed Compiles: https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/server-pro-only-configuration/sandboxed-compiles + SANDBOXED_COMPILES: "true" + ### Bind-mount source for /var/lib/overleaf/data/compiles inside the container. + SANDBOXED_COMPILES_HOST_DIR_COMPILES: "/home/user/sharelatex_data/data/compiles" + ### Bind-mount source for /var/lib/overleaf/data/output inside the container. + SANDBOXED_COMPILES_HOST_DIR_OUTPUT: "/home/user/sharelatex_data/data/output" + ### Backwards compatibility (before Server Pro 5.5) + DOCKER_RUNNER: "true" + SANDBOXED_COMPILES_SIBLING_CONTAINERS: "true" - ## The Community Edition is intended for use in environments where all users are trusted and is not appropriate for - ## scenarios where isolation of users is required. Sandboxed Compiles are not available in the Community Edition, - ## so the following environment variables must be commented out to avoid compile issues. - ## - ## Sandboxed Compiles: https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/server-pro-only-configuration/sandboxed-compiles - SANDBOXED_COMPILES: 'true' - ### Bind-mount source for /var/lib/overleaf/data/compiles inside the container. - SANDBOXED_COMPILES_HOST_DIR_COMPILES: '/home/user/sharelatex_data/data/compiles' - ### Bind-mount source for /var/lib/overleaf/data/output inside the container. - SANDBOXED_COMPILES_HOST_DIR_OUTPUT: '/home/user/sharelatex_data/data/output' - ### Backwards compatibility (before Server Pro 5.5) - DOCKER_RUNNER: 'true' - SANDBOXED_COMPILES_SIBLING_CONTAINERS: 'true' + ## Works with test LDAP server shown at bottom of docker compose + # OVERLEAF_LDAP_URL: 'ldap://ldap:389' + # OVERLEAF_LDAP_SEARCH_BASE: 'ou=people,dc=planetexpress,dc=com' + # OVERLEAF_LDAP_SEARCH_FILTER: '(uid={{username}})' + # OVERLEAF_LDAP_BIND_DN: 'cn=admin,dc=planetexpress,dc=com' + # OVERLEAF_LDAP_BIND_CREDENTIALS: 'GoodNewsEveryone' + # OVERLEAF_LDAP_EMAIL_ATT: 'mail' + # OVERLEAF_LDAP_NAME_ATT: 'cn' + # OVERLEAF_LDAP_LAST_NAME_ATT: 'sn' + # OVERLEAF_LDAP_UPDATE_USER_DETAILS_ON_LOGIN: 'true' - ## Works with test LDAP server shown at bottom of docker compose - # OVERLEAF_LDAP_URL: 'ldap://ldap:389' - # OVERLEAF_LDAP_SEARCH_BASE: 'ou=people,dc=planetexpress,dc=com' - # OVERLEAF_LDAP_SEARCH_FILTER: '(uid={{username}})' - # OVERLEAF_LDAP_BIND_DN: 'cn=admin,dc=planetexpress,dc=com' - # OVERLEAF_LDAP_BIND_CREDENTIALS: 'GoodNewsEveryone' - # OVERLEAF_LDAP_EMAIL_ATT: 'mail' - # OVERLEAF_LDAP_NAME_ATT: 'cn' - # OVERLEAF_LDAP_LAST_NAME_ATT: 'sn' - # OVERLEAF_LDAP_UPDATE_USER_DETAILS_ON_LOGIN: 'true' + # OVERLEAF_TEMPLATES_USER_ID: "578773160210479700917ee5" + # OVERLEAF_NEW_PROJECT_TEMPLATE_LINKS: '[ {"name":"All Templates","url":"/templates/all"}]' - # OVERLEAF_TEMPLATES_USER_ID: "578773160210479700917ee5" - # OVERLEAF_NEW_PROJECT_TEMPLATE_LINKS: '[ {"name":"All Templates","url":"/templates/all"}]' + # OVERLEAF_PROXY_LEARN: "true" + mongo: + restart: always + image: mongo:6.0 + container_name: mongo + command: "--replSet overleaf" + volumes: + - ~/mongo_data:/data/db + - ./bin/shared/mongodb-init-replica-set.js:/docker-entrypoint-initdb.d/mongodb-init-replica-set.js + environment: + MONGO_INITDB_DATABASE: sharelatex + extra_hosts: + # Required when using the automatic database setup for initializing the replica set. + # This override is not needed when running the setup after starting up mongo. + - mongo:127.0.0.1 + healthcheck: + test: echo 'db.stats().ok' | mongosh localhost:27017/test --quiet + interval: 10s + timeout: 10s + retries: 5 - # OVERLEAF_PROXY_LEARN: "true" + redis: + restart: always + image: redis:6.2 + container_name: redis + volumes: + - ~/redis_data:/data - mongo: - restart: always - image: mongo:6.0 - container_name: mongo - command: '--replSet overleaf' - volumes: - - ~/mongo_data:/data/db - - ./bin/shared/mongodb-init-replica-set.js:/docker-entrypoint-initdb.d/mongodb-init-replica-set.js - environment: - MONGO_INITDB_DATABASE: sharelatex - extra_hosts: - # Required when using the automatic database setup for initializing the replica set. - # This override is not needed when running the setup after starting up mongo. - - mongo:127.0.0.1 - healthcheck: - test: echo 'db.stats().ok' | mongosh localhost:27017/test --quiet - interval: 10s - timeout: 10s - retries: 5 + # ldap: + # restart: always + # image: rroemhild/test-openldap + # container_name: ldap - redis: - restart: always - image: redis:6.2 - container_name: redis - volumes: - - ~/redis_data:/data + # See https://github.com/jwilder/nginx-proxy for documentation on how to configure the nginx-proxy container, + # and https://github.com/overleaf/overleaf/wiki/HTTPS-reverse-proxy-using-Nginx for an example of some recommended + # settings. We recommend using a properly managed nginx instance outside of the Overleaf Server Pro setup, + # but the example here can be used if you'd prefer to run everything with docker-compose - # ldap: - # restart: always - # image: rroemhild/test-openldap - # container_name: ldap - - # See https://github.com/jwilder/nginx-proxy for documentation on how to configure the nginx-proxy container, - # and https://github.com/overleaf/overleaf/wiki/HTTPS-reverse-proxy-using-Nginx for an example of some recommended - # settings. We recommend using a properly managed nginx instance outside of the Overleaf Server Pro setup, - # but the example here can be used if you'd prefer to run everything with docker-compose - - # nginx-proxy: - # image: jwilder/nginx-proxy - # container_name: nginx-proxy - # ports: - # - "80:80" - # - "443:443" - # volumes: - # - /var/run/docker.sock:/tmp/docker.sock:ro - # - /home/overleaf/tmp:/etc/nginx/certs + # nginx-proxy: + # image: jwilder/nginx-proxy + # container_name: nginx-proxy + # ports: + # - "80:80" + # - "443:443" + # volumes: + # - /var/run/docker.sock:/tmp/docker.sock:ro + # - /home/overleaf/tmp:/etc/nginx/certs diff --git a/libraries/access-token-encryptor/package.json b/libraries/access-token-encryptor/package.json index fda3d2341f..8589ce6136 100644 --- a/libraries/access-token-encryptor/package.json +++ b/libraries/access-token-encryptor/package.json @@ -4,11 +4,9 @@ "description": "", "main": "index.js", "scripts": { - "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", + "test": "npm run lint && npm run types:check && npm run test:unit", "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", - "format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", "types:check": "tsc --noEmit" diff --git a/libraries/access-token-encryptor/tsconfig.json b/libraries/access-token-encryptor/tsconfig.json index 78761754eb..5c3833f9db 100644 --- a/libraries/access-token-encryptor/tsconfig.json +++ b/libraries/access-token-encryptor/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.ts"] } diff --git a/libraries/eslint-plugin/tsconfig.json b/libraries/eslint-plugin/tsconfig.json index 4ae1be95bf..a8e4493a10 100644 --- a/libraries/eslint-plugin/tsconfig.json +++ b/libraries/eslint-plugin/tsconfig.json @@ -1,6 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - ] + "include": ["**/*.js"] } diff --git a/libraries/fetch-utils/package.json b/libraries/fetch-utils/package.json index 9021bb0521..22f9ac81d0 100644 --- a/libraries/fetch-utils/package.json +++ b/libraries/fetch-utils/package.json @@ -4,11 +4,9 @@ "description": "utilities for node-fetch", "main": "index.js", "scripts": { - "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", + "test": "npm run lint && npm run types:check && npm run test:unit", "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", - "format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", "types:check": "tsc --noEmit" diff --git a/libraries/fetch-utils/tsconfig.json b/libraries/fetch-utils/tsconfig.json index 78761754eb..5c3833f9db 100644 --- a/libraries/fetch-utils/tsconfig.json +++ b/libraries/fetch-utils/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.ts"] } diff --git a/libraries/logger/CHANGELOG.md b/libraries/logger/CHANGELOG.md index a581cf4077..e59b3011e1 100644 --- a/libraries/logger/CHANGELOG.md +++ b/libraries/logger/CHANGELOG.md @@ -1,10 +1,9 @@ ## v3.1.1 -* Handle malformed requests in the req serializer +- Handle malformed requests in the req serializer ## v3.0.0 -* Improve logging in Google Cloud Platform. Set environment variable `GCP_LOGGING=true` to enable. +- Improve logging in Google Cloud Platform. Set environment variable `GCP_LOGGING=true` to enable. This version of the metrics module only works with versions of the `@overleaf/metrics` module greater than v4.0.0 - diff --git a/libraries/logger/package.json b/libraries/logger/package.json index c12ae4e12a..d600db7a44 100644 --- a/libraries/logger/package.json +++ b/libraries/logger/package.json @@ -10,9 +10,7 @@ "license": "AGPL-3.0-only", "version": "3.1.1", "scripts": { - "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", - "format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'", + "test": "npm run lint && npm run types:check && npm run test:unit", "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:ci": "npm run test:unit", diff --git a/libraries/logger/tsconfig.json b/libraries/logger/tsconfig.json index 78761754eb..5c3833f9db 100644 --- a/libraries/logger/tsconfig.json +++ b/libraries/logger/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.ts"] } diff --git a/libraries/metrics/CHANGELOG.md b/libraries/metrics/CHANGELOG.md index 30f24ea358..ee71344e2e 100644 --- a/libraries/metrics/CHANGELOG.md +++ b/libraries/metrics/CHANGELOG.md @@ -1,9 +1,9 @@ ## v4.1.0 -* Allows skipping the `sampleRate` argument. +- Allows skipping the `sampleRate` argument. ## v4.0.0 -* Send unmodified request and response to logger. +- Send unmodified request and response to logger. This version of the metrics module only works with versions of the `@overleaf/logger` module greater than v3.0.0 diff --git a/libraries/metrics/package.json b/libraries/metrics/package.json index 23eaccb869..28d0e24f0f 100644 --- a/libraries/metrics/package.json +++ b/libraries/metrics/package.json @@ -35,9 +35,7 @@ "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:unit": "mocha --exit test/**/*.{js,cjs}", "test:acceptance": "mocha --recursive --exit --grep=$MOCHA_GREP test/acceptance", - "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", - "format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'", + "test": "npm run lint && npm run types:check && npm run test:unit", "test:ci": "npm run test:unit", "types:check": "tsc --noEmit" }, diff --git a/libraries/metrics/tsconfig.json b/libraries/metrics/tsconfig.json index 78761754eb..5c3833f9db 100644 --- a/libraries/metrics/tsconfig.json +++ b/libraries/metrics/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.ts"] } diff --git a/libraries/mongo-utils/package.json b/libraries/mongo-utils/package.json index db038ad942..642f835dd9 100644 --- a/libraries/mongo-utils/package.json +++ b/libraries/mongo-utils/package.json @@ -4,12 +4,10 @@ "description": "utilities to help working with mongo", "main": "index.js", "scripts": { - "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", + "test": "npm run lint && npm run types:check && npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", - "format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'", "test:ci": "npm run test:unit", "types:check": "tsc --noEmit" }, diff --git a/libraries/mongo-utils/tsconfig.json b/libraries/mongo-utils/tsconfig.json index 78761754eb..5c3833f9db 100644 --- a/libraries/mongo-utils/tsconfig.json +++ b/libraries/mongo-utils/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.ts"] } diff --git a/libraries/o-error/README.md b/libraries/o-error/README.md index cf6582b854..9f79c3343e 100644 --- a/libraries/o-error/README.md +++ b/libraries/o-error/README.md @@ -16,23 +16,23 @@ Light-weight helpers for handling JavaScript Errors in node.js and the browser. - [Long Stack Traces with `OError.tag`](#long-stack-traces-with-oerrortag) - * [The Problem](#the-problem) - * [The Solution](#the-solution) - * [Adding More Info](#adding-more-info) - * [`async`/`await`](#asyncawait) - * [Better Async Stack Traces in Node 12+](#better-async-stack-traces-in-node-12) - * [Caveat: Shared Error Instances](#caveat-shared-error-instances) + - [The Problem](#the-problem) + - [The Solution](#the-solution) + - [Adding More Info](#adding-more-info) + - [`async`/`await`](#asyncawait) + - [Better Async Stack Traces in Node 12+](#better-async-stack-traces-in-node-12) + - [Caveat: Shared Error Instances](#caveat-shared-error-instances) - [Create Custom Error Classes](#create-custom-error-classes) - * [Attaching Extra Info](#attaching-extra-info) - * [Wrapping an Internal Error](#wrapping-an-internal-error) + - [Attaching Extra Info](#attaching-extra-info) + - [Wrapping an Internal Error](#wrapping-an-internal-error) - [OError API Reference](#oerror-api-reference) - * [new OError(message, [info], [cause])](#new-oerrormessage-info-cause) - * [oError.withInfo(info) ⇒ this](#oerrorwithinfoinfo--this) - * [oError.withCause(cause) ⇒ this](#oerrorwithcausecause--this) - * [OError.maxTags : Number](#oerrormaxtags--number) - * [OError.tag(error, [message], [info]) ⇒ Error](#oerrortagerror-message-info--error) - * [OError.getFullInfo(error) ⇒ Object](#oerrorgetfullinfoerror--object) - * [OError.getFullStack(error) ⇒ string](#oerrorgetfullstackerror--string) + - [new OError(message, [info], [cause])](#new-oerrormessage-info-cause) + - [oError.withInfo(info) ⇒ this](#oerrorwithinfoinfo--this) + - [oError.withCause(cause) ⇒ this](#oerrorwithcausecause--this) + - [OError.maxTags : Number](#oerrormaxtags--number) + - [OError.tag(error, [message], [info]) ⇒ Error](#oerrortagerror-message-info--error) + - [OError.getFullInfo(error) ⇒ Object](#oerrorgetfullinfoerror--object) + - [OError.getFullStack(error) ⇒ string](#oerrorgetfullstackerror--string) - [References](#references) @@ -345,52 +345,56 @@ caused by: ## OError API Reference -* [OError](#OError) - * [new OError(message, [info], [cause])](#new_OError_new) - * _instance_ - * [.withInfo(info)](#OError+withInfo) ⇒ this - * [.withCause(cause)](#OError+withCause) ⇒ this - * _static_ - * [.maxTags](#OError.maxTags) : Number - * [.tag(error, [message], [info])](#OError.tag) ⇒ Error - * [.getFullInfo(error)](#OError.getFullInfo) ⇒ Object - * [.getFullStack(error)](#OError.getFullStack) ⇒ string + +- [OError](#OError) + - [new OError(message, [info], [cause])](#new_OError_new) + - _instance_ + - [.withInfo(info)](#OError+withInfo) ⇒ this + - [.withCause(cause)](#OError+withCause) ⇒ this + - _static_ + - [.maxTags](#OError.maxTags) : Number + - [.tag(error, [message], [info])](#OError.tag) ⇒ Error + - [.getFullInfo(error)](#OError.getFullInfo) ⇒ Object + - [.getFullStack(error)](#OError.getFullStack) ⇒ string ### new OError(message, [info], [cause]) -| Param | Type | Description | -| --- | --- | --- | -| message | string | as for built-in Error | -| [info] | Object | extra data to attach to the error | -| [cause] | Error | the internal error that caused this error | +| Param | Type | Description | +| ------- | ------------------- | ----------------------------------------- | +| message | string | as for built-in Error | +| [info] | Object | extra data to attach to the error | +| [cause] | Error | the internal error that caused this error | ### oError.withInfo(info) ⇒ this + Set the extra info object for this error. -**Kind**: instance method of [OError](#OError) +**Kind**: instance method of [OError](#OError) -| Param | Type | Description | -| --- | --- | --- | -| info | Object | extra data to attach to the error | +| Param | Type | Description | +| ----- | ------------------- | --------------------------------- | +| info | Object | extra data to attach to the error | ### oError.withCause(cause) ⇒ this + Wrap the given error, which caused this error. -**Kind**: instance method of [OError](#OError) +**Kind**: instance method of [OError](#OError) -| Param | Type | Description | -| --- | --- | --- | +| Param | Type | Description | +| ----- | ------------------ | ----------------------------------------- | | cause | Error | the internal error that caused this error | ### OError.maxTags : Number + Maximum number of tags to apply to any one error instance. This is to avoid a resource leak in the (hopefully unlikely) case that a singleton error instance is returned to many callbacks. If tags have been dropped, the full @@ -402,19 +406,21 @@ Defaults to 100. Must be at least 1. ### OError.tag(error, [message], [info]) ⇒ Error + Tag debugging information onto any error (whether an OError or not) and return it. **Kind**: static method of [OError](#OError) -**Returns**: Error - the modified `error` argument +**Returns**: Error - the modified `error` argument -| Param | Type | Description | -| --- | --- | --- | -| error | Error | the error to tag | -| [message] | string | message with which to tag `error` | -| [info] | Object | extra data with wich to tag `error` | +| Param | Type | Description | +| --------- | ------------------- | ----------------------------------- | +| error | Error | the error to tag | +| [message] | string | message with which to tag `error` | +| [info] | Object | extra data with wich to tag `error` | + +**Example** _(An error in a callback)_ -**Example** *(An error in a callback)* ```js function findUser(name, callback) { fs.readFile('/etc/passwd', (err, data) => { @@ -423,13 +429,17 @@ function findUser(name, callback) { }) } ``` -**Example** *(A possible error in a callback)* + +**Example** _(A possible error in a callback)_ + ```js function cleanup(callback) { - fs.unlink('/tmp/scratch', (err) => callback(err && OError.tag(err))) + fs.unlink('/tmp/scratch', err => callback(err && OError.tag(err))) } ``` -**Example** *(An error with async/await)* + +**Example** _(An error with async/await)_ + ```js async function cleanup() { try { @@ -439,30 +449,34 @@ async function cleanup() { } } ``` + ### OError.getFullInfo(error) ⇒ Object + The merged info from any `tag`s and causes on the given error. If an info property is repeated, the last one wins. -**Kind**: static method of [OError](#OError) +**Kind**: static method of [OError](#OError) -| Param | Type | Description | -| --- | --- | --- | +| Param | Type | Description | +| ----- | ----------------------------------------------------------------- | ----------------------------------------- | | error | Error \| null \| undefined | any error (may or may not be an `OError`) | ### OError.getFullStack(error) ⇒ string + Return the `stack` property from `error`, including the `stack`s for any tagged errors added with `OError.tag` and for any `cause`s. -**Kind**: static method of [OError](#OError) +**Kind**: static method of [OError](#OError) -| Param | Type | Description | -| --- | --- | --- | +| Param | Type | Description | +| ----- | ----------------------------------------------------------------- | ----------------------------------------- | | error | Error \| null \| undefined | any error (may or may not be an `OError`) | + ## References diff --git a/libraries/o-error/package.json b/libraries/o-error/package.json index 3676dfa9a1..1eef934afb 100644 --- a/libraries/o-error/package.json +++ b/libraries/o-error/package.json @@ -20,9 +20,7 @@ "build": "npm run --silent test", "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", - "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", - "format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'", + "test": "npm run lint && npm run types:check && npm run test:unit", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", "types:check": "tsc --noEmit" diff --git a/libraries/o-error/tsconfig.json b/libraries/o-error/tsconfig.json index 78761754eb..5c3833f9db 100644 --- a/libraries/o-error/tsconfig.json +++ b/libraries/o-error/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.ts"] } diff --git a/libraries/object-persistor/.prettierignore b/libraries/object-persistor/.prettierignore deleted file mode 100644 index 3c3629e647..0000000000 --- a/libraries/object-persistor/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/libraries/object-persistor/README.md b/libraries/object-persistor/README.md index 23bb05b361..72ce6921b7 100644 --- a/libraries/object-persistor/README.md +++ b/libraries/object-persistor/README.md @@ -46,9 +46,9 @@ Uploads a stream to the backend. - `key`: The key for the uploaded object - `readStream`: The data stream to upload - `opts` (optional): - - `sourceMd5`: The md5 hash of the source data, if known. The uploaded data will be compared against this and the operation will fail if it does not match. If omitted, the md5 is calculated as the data is uploaded instead, and verified against the backend. This is not supported in `S3Persistor` as it performs [its own integrity protections](https://aws.amazon.com/blogs/aws/introducing-default-data-integrity-protections-for-new-objects-in-amazon-s3/). Setting `sourceMd5` with `S3Persistor` will result in an error being thrown. - - `contentType`: The content type to write in the object metadata - - `contentEncoding`: The content encoding to write in the object metadata + - `sourceMd5`: The md5 hash of the source data, if known. The uploaded data will be compared against this and the operation will fail if it does not match. If omitted, the md5 is calculated as the data is uploaded instead, and verified against the backend. This is not supported in `S3Persistor` as it performs [its own integrity protections](https://aws.amazon.com/blogs/aws/introducing-default-data-integrity-protections-for-new-objects-in-amazon-s3/). Setting `sourceMd5` with `S3Persistor` will result in an error being thrown. + - `contentType`: The content type to write in the object metadata + - `contentEncoding`: The content encoding to write in the object metadata ##### Notes diff --git a/libraries/object-persistor/package.json b/libraries/object-persistor/package.json index c13adee40f..cacc2f034d 100644 --- a/libraries/object-persistor/package.json +++ b/libraries/object-persistor/package.json @@ -4,12 +4,10 @@ "description": "Module for storing objects in multiple backends, with fallback on 404 to assist migration between them", "main": "index.js", "scripts": { - "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", + "test": "npm run lint && npm run types:check && npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", - "format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'", "test:ci": "npm run test:unit", "types:check": "tsc --noEmit" }, diff --git a/libraries/object-persistor/tsconfig.json b/libraries/object-persistor/tsconfig.json index 78761754eb..5c3833f9db 100644 --- a/libraries/object-persistor/tsconfig.json +++ b/libraries/object-persistor/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.ts"] } diff --git a/libraries/overleaf-editor-core/package.json b/libraries/overleaf-editor-core/package.json index be09da6554..cfae70d3f1 100644 --- a/libraries/overleaf-editor-core/package.json +++ b/libraries/overleaf-editor-core/package.json @@ -4,9 +4,7 @@ "description": "Library shared between the editor server and clients.", "main": "index.js", "scripts": { - "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", - "format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'", + "test": "npm run lint && npm run types:check && npm run test:unit", "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:ci": "npm run test:unit", diff --git a/libraries/overleaf-editor-core/tsconfig.json b/libraries/overleaf-editor-core/tsconfig.json index 78761754eb..5c3833f9db 100644 --- a/libraries/overleaf-editor-core/tsconfig.json +++ b/libraries/overleaf-editor-core/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.ts"] } diff --git a/libraries/promise-utils/package.json b/libraries/promise-utils/package.json index e19538422d..e1286de130 100644 --- a/libraries/promise-utils/package.json +++ b/libraries/promise-utils/package.json @@ -4,12 +4,10 @@ "description": "utilities to help working with promises", "main": "index.js", "scripts": { - "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", + "test": "npm run lint && npm run types:check && npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", - "format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'", "test:ci": "npm run test:unit", "types:check": "tsc --noEmit" }, diff --git a/libraries/promise-utils/tsconfig.json b/libraries/promise-utils/tsconfig.json index 78761754eb..5c3833f9db 100644 --- a/libraries/promise-utils/tsconfig.json +++ b/libraries/promise-utils/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.ts"] } diff --git a/libraries/ranges-tracker/package.json b/libraries/ranges-tracker/package.json index 7ea19adca1..0d67387cf0 100644 --- a/libraries/ranges-tracker/package.json +++ b/libraries/ranges-tracker/package.json @@ -11,9 +11,7 @@ "scripts": { "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", - "format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'", - "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", + "test": "npm run lint && npm run types:check && npm run test:unit", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", "types:check": "tsc --noEmit" diff --git a/libraries/ranges-tracker/tsconfig.json b/libraries/ranges-tracker/tsconfig.json index 78761754eb..5c3833f9db 100644 --- a/libraries/ranges-tracker/tsconfig.json +++ b/libraries/ranges-tracker/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.ts"] } diff --git a/libraries/redis-wrapper/package.json b/libraries/redis-wrapper/package.json index 62e2f3642e..d45c46ae23 100644 --- a/libraries/redis-wrapper/package.json +++ b/libraries/redis-wrapper/package.json @@ -15,9 +15,7 @@ "scripts": { "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", - "format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'", - "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", + "test": "npm run lint && npm run types:check && npm run test:unit", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", "types:check": "tsc --noEmit" diff --git a/libraries/redis-wrapper/tsconfig.json b/libraries/redis-wrapper/tsconfig.json index 78761754eb..5c3833f9db 100644 --- a/libraries/redis-wrapper/tsconfig.json +++ b/libraries/redis-wrapper/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.ts"] } diff --git a/libraries/settings/README.md b/libraries/settings/README.md index c06978bba3..9f46600763 100644 --- a/libraries/settings/README.md +++ b/libraries/settings/README.md @@ -1,16 +1,14 @@ -@overleaf/settings -=================== +# @overleaf/settings A small module to allow global config settings to be set for all services within the Overleaf architecture. -Settings file location ----------------------- +## Settings file location You can specify a custom location for the settings file by setting the `OVERLEAF_CONFIG` environment variable. E.g. - $ export OVERLEAF_CONFIG=/home/james/config/settings.development.js + $ export OVERLEAF_CONFIG=/home/james/config/settings.development.js Otherwise, the settings will be loaded from `config/settings.NODE_ENV.js`, where `NODE_ENV` is another environment variable, or defaults to `development`. diff --git a/libraries/settings/package.json b/libraries/settings/package.json index bfbd717039..f21a32c313 100644 --- a/libraries/settings/package.json +++ b/libraries/settings/package.json @@ -7,9 +7,7 @@ "scripts": { "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", - "format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'", - "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", + "test": "npm run lint && npm run types:check && npm run test:unit", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", "types:check": "tsc --noEmit" diff --git a/libraries/settings/tsconfig.json b/libraries/settings/tsconfig.json index 78761754eb..5c3833f9db 100644 --- a/libraries/settings/tsconfig.json +++ b/libraries/settings/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.ts"] } diff --git a/libraries/stream-utils/package.json b/libraries/stream-utils/package.json index 82fcd98883..7a4437e198 100644 --- a/libraries/stream-utils/package.json +++ b/libraries/stream-utils/package.json @@ -4,12 +4,10 @@ "description": "stream handling utilities", "main": "index.js", "scripts": { - "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", + "test": "npm run lint && npm run types:check && npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", - "format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'", "test:ci": "npm run test:unit", "types:check": "tsc --noEmit" }, diff --git a/libraries/stream-utils/tsconfig.json b/libraries/stream-utils/tsconfig.json index 78761754eb..5c3833f9db 100644 --- a/libraries/stream-utils/tsconfig.json +++ b/libraries/stream-utils/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.ts"] } diff --git a/libraries/validation-tools/package.json b/libraries/validation-tools/package.json index 9245b284f0..15906a84d7 100644 --- a/libraries/validation-tools/package.json +++ b/libraries/validation-tools/package.json @@ -10,9 +10,7 @@ "license": "AGPL-3.0-only", "version": "1.0.0", "scripts": { - "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", - "format": "prettier --list-different $PWD/'**/*.{js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{js,cjs,ts}'", + "test": "npm run lint && npm run types:check && npm run test:unit", "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:ci": "npm run test:unit", diff --git a/libraries/validation-tools/tsconfig.json b/libraries/validation-tools/tsconfig.json index 78761754eb..5c3833f9db 100644 --- a/libraries/validation-tools/tsconfig.json +++ b/libraries/validation-tools/tsconfig.json @@ -1,8 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.ts"] } diff --git a/package-lock.json b/package-lock.json index 3c67d44933..bb481eedf5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,6 +40,7 @@ "patch-package": "^8.0.0" }, "devDependencies": { + "@prettier/plugin-pug": "^3.4.0", "@types/chai": "^4.3.0", "@types/chai-as-promised": "^7.1.8", "@types/mocha": "^10.0.6", @@ -58397,7 +58398,6 @@ "@pollyjs/adapter-node-http": "^6.0.6", "@pollyjs/core": "^6.0.6", "@pollyjs/persister-fs": "^6.0.6", - "@prettier/plugin-pug": "^3.4.0", "@replit/codemirror-emacs": "overleaf/codemirror-emacs#4394c03858f27053f8768258e9493866e06e938e", "@replit/codemirror-indentation-markers": "overleaf/codemirror-indentation-markers#371ce3b56f453a392eb0d3b85ab019c185c68e1f", "@replit/codemirror-vim": "overleaf/codemirror-vim#1bef138382d948018f3f9b8a4d7a70ab61774e4b", diff --git a/package.json b/package.json index 49c67c921d..56e3e0a2b8 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "patch-package": "^8.0.0" }, "devDependencies": { + "@prettier/plugin-pug": "^3.4.0", "@types/chai": "^4.3.0", "@types/chai-as-promised": "^7.1.8", "@types/mocha": "^10.0.6", @@ -41,10 +42,14 @@ } }, "scripts": { - "format": "prettier --list-different $PWD/'**/*.js'", - "format:fix": "prettier --write $PWD/'**/*.js'", - "format:jenkins": "prettier --list-different $PWD/'**/Jenkinsfile'", - "format:jenkins:fix": "prettier --write $PWD/'**/Jenkinsfile'", + "format": "prettier --list-different", + "format:fix": "prettier --write --list-different", + "format:styles": "prettier --list-different '**/*.{css,scss}'", + "format:styles:fix": "prettier --write --list-different '**/*.{css,scss}'", + "format:pug": "prettier --list-different '**/*.pug'", + "format:pug:fix": "prettier --write --list-different '**/*.pug'", + "format:jenkins": "prettier --list-different '**/Jenkinsfile'", + "format:jenkins:fix": "prettier --write --list-different '**/Jenkinsfile'", "lint": "eslint --max-warnings 0 --format unix .", "lint:fix": "eslint --fix .", "postinstall": "patch-package" diff --git a/server-ce/cloudbuild.public.yaml b/server-ce/cloudbuild.public.yaml index f682a173e6..e7363da065 100644 --- a/server-ce/cloudbuild.public.yaml +++ b/server-ce/cloudbuild.public.yaml @@ -1,11 +1,10 @@ --- - steps: - id: build_base name: us-east1-docker.pkg.dev/overleaf-ops/ol-docker/cloud-builder dir: server-ce args: - - 'build-base' + - "build-base" - id: tag_main_latest_base name: gcr.io/cloud-builders/docker script: | @@ -26,7 +25,7 @@ steps: exit 0 automapSubstitutions: true waitFor: - - '-' + - "-" - id: build_community name: us-east1-docker.pkg.dev/overleaf-ops/ol-docker/cloud-builder dir: server-ce @@ -51,27 +50,27 @@ timeout: 3600s options: machineType: E2_HIGHCPU_32 env: - - 'BRANCH_NAME=${BRANCH_NAME}' + - "BRANCH_NAME=${BRANCH_NAME}" # docker build - - 'OVERLEAF_BASE_BRANCH=${_IMAGE_BASE_BRANCH}' - - 'OVERLEAF_BASE_LATEST=${_IMAGE_BASE_LATEST}' - - 'OVERLEAF_BASE_TAG=${_IMAGE_BASE}' - - 'OVERLEAF_BRANCH=${_IMAGE_TAG_BRANCH}' - - 'OVERLEAF_LATEST=${_IMAGE_TAG_LATEST}' - - 'OVERLEAF_TAG=${_IMAGE_TAG}' + - "OVERLEAF_BASE_BRANCH=${_IMAGE_BASE_BRANCH}" + - "OVERLEAF_BASE_LATEST=${_IMAGE_BASE_LATEST}" + - "OVERLEAF_BASE_TAG=${_IMAGE_BASE}" + - "OVERLEAF_BRANCH=${_IMAGE_TAG_BRANCH}" + - "OVERLEAF_LATEST=${_IMAGE_TAG_LATEST}" + - "OVERLEAF_TAG=${_IMAGE_TAG}" images: - - '${_IMAGE_BASE}' - - '${_IMAGE_BASE_BRANCH}' - - '${_IMAGE_TAG}' - - '${_IMAGE_TAG_BRANCH}' + - "${_IMAGE_BASE}" + - "${_IMAGE_BASE_BRANCH}" + - "${_IMAGE_TAG}" + - "${_IMAGE_TAG_BRANCH}" substitutions: - _IMAGE_BASE: 'us-east1-docker.pkg.dev/overleaf-ops/ol-docker/overleaf-base:${BRANCH_NAME}-${SHORT_SHA}_${BUILD_ID}' - _IMAGE_BASE_BRANCH: 'us-east1-docker.pkg.dev/overleaf-ops/ol-docker/overleaf-base:${BRANCH_NAME}' - _IMAGE_BASE_LATEST: 'us-east1-docker.pkg.dev/overleaf-ops/ol-docker/overleaf-base:latest' - _IMAGE_TAG_BRANCH: 'us-east1-docker.pkg.dev/overleaf-ops/ol-docker/overleaf:${BRANCH_NAME}' - _IMAGE_TAG_LATEST: 'us-east1-docker.pkg.dev/overleaf-ops/ol-docker/overleaf:latest' - _IMAGE_TAG: 'us-east1-docker.pkg.dev/overleaf-ops/ol-docker/overleaf:${BRANCH_NAME}-${SHORT_SHA}_${BUILD_ID}' + _IMAGE_BASE: "us-east1-docker.pkg.dev/overleaf-ops/ol-docker/overleaf-base:${BRANCH_NAME}-${SHORT_SHA}_${BUILD_ID}" + _IMAGE_BASE_BRANCH: "us-east1-docker.pkg.dev/overleaf-ops/ol-docker/overleaf-base:${BRANCH_NAME}" + _IMAGE_BASE_LATEST: "us-east1-docker.pkg.dev/overleaf-ops/ol-docker/overleaf-base:latest" + _IMAGE_TAG_BRANCH: "us-east1-docker.pkg.dev/overleaf-ops/ol-docker/overleaf:${BRANCH_NAME}" + _IMAGE_TAG_LATEST: "us-east1-docker.pkg.dev/overleaf-ops/ol-docker/overleaf:latest" + _IMAGE_TAG: "us-east1-docker.pkg.dev/overleaf-ops/ol-docker/overleaf:${BRANCH_NAME}-${SHORT_SHA}_${BUILD_ID}" tags: - - 'overleaf-public' - - '${BRANCH_NAME}' - - '${SHORT_SHA}' + - "overleaf-public" + - "${BRANCH_NAME}" + - "${SHORT_SHA}" diff --git a/server-ce/test/docker-compose.native.yml b/server-ce/test/docker-compose.native.yml index c229f6a546..d12c96d70c 100644 --- a/server-ce/test/docker-compose.native.yml +++ b/server-ce/test/docker-compose.native.yml @@ -1,24 +1,24 @@ -version: '2.2' +version: "2.2" services: sharelatex: ports: - "127.0.0.1:80:80" environment: - OVERLEAF_SITE_URL: 'http://localhost' + OVERLEAF_SITE_URL: "http://localhost" host-admin: ports: - "127.0.0.1:8081:80" environment: - NATIVE_CYPRESS: 'true' - ACCESS_CONTROL_ALLOW_ORIGIN: 'http://localhost' + NATIVE_CYPRESS: "true" + ACCESS_CONTROL_ALLOW_ORIGIN: "http://localhost" saml: ports: - 127.0.0.1:8082:80 environment: - SAML_BASE_URL_PATH: 'http://localhost:8082/simplesaml/' - SAML_TEST_SP_LOCATION: 'http://localhost/saml/callback' + SAML_BASE_URL_PATH: "http://localhost:8082/simplesaml/" + SAML_TEST_SP_LOCATION: "http://localhost/saml/callback" mailtrap: ports: diff --git a/server-ce/test/docker-compose.yml b/server-ce/test/docker-compose.yml index d1e2ebd9e5..c7237fa4f8 100644 --- a/server-ce/test/docker-compose.yml +++ b/server-ce/test/docker-compose.yml @@ -10,18 +10,18 @@ services: mailtrap: condition: service_started environment: - OVERLEAF_SITE_URL: 'http://sharelatex' + OVERLEAF_SITE_URL: "http://sharelatex" OVERLEAF_APP_NAME: E2E test OVERLEAF_MONGO_URL: mongodb://mongo/sharelatex?directConnection=true OVERLEAF_REDIS_HOST: redis REDIS_HOST: redis - OVERLEAF_EMAIL_FROM_ADDRESS: 'welcome@example.com' - OVERLEAF_EMAIL_SMTP_HOST: 'mailtrap' - OVERLEAF_EMAIL_SMTP_PORT: '25' - OVERLEAF_EMAIL_SMTP_IGNORE_TLS: 'true' - ENABLED_LINKED_FILE_TYPES: 'project_file,project_output_file' - ENABLE_CONVERSIONS: 'true' - EMAIL_CONFIRMATION_DISABLED: 'true' + OVERLEAF_EMAIL_FROM_ADDRESS: "welcome@example.com" + OVERLEAF_EMAIL_SMTP_HOST: "mailtrap" + OVERLEAF_EMAIL_SMTP_PORT: "25" + OVERLEAF_EMAIL_SMTP_IGNORE_TLS: "true" + ENABLED_LINKED_FILE_TYPES: "project_file,project_output_file" + ENABLE_CONVERSIONS: "true" + EMAIL_CONFIRMATION_DISABLED: "true" healthcheck: test: curl --fail http://localhost:3000/status interval: 3s @@ -31,11 +31,11 @@ services: mailtrap: image: mailtrap environment: - MAILTRAP_PASSWORD: 'password-for-mailtrap' + MAILTRAP_PASSWORD: "password-for-mailtrap" mongo: image: mongo:8.0.11 - command: '--replSet overleaf' + command: "--replSet overleaf" volumes: - ../bin/shared/mongodb-init-replica-set.js:/docker-entrypoint-initdb.d/mongodb-init-replica-set.js - ../bin/shared/mongodb-docker-entrypoint-wait.sh:/mongodb-docker-entrypoint-wait.sh @@ -129,9 +129,9 @@ services: restart: always image: us-east1-docker.pkg.dev/overleaf-ops/ol-docker/saml-test environment: - SAML_TEST_SP_ENTITY_ID: 'sharelatex-test-saml' - SAML_BASE_URL_PATH: 'http://saml/simplesaml/' - SAML_TEST_SP_LOCATION: 'http://sharelatex/saml/callback' + SAML_TEST_SP_ENTITY_ID: "sharelatex-test-saml" + SAML_BASE_URL_PATH: "http://saml/simplesaml/" + SAML_TEST_SP_LOCATION: "http://sharelatex/saml/callback" ldap: restart: always @@ -140,6 +140,6 @@ services: # REF: https://github.com/moby/moby/issues/8231#issuecomment-63877553 # REF: https://github.com/moby/moby/issues/8231#issuecomment-63871343 command: - - 'bash' - - '-c' - - 'ulimit -n 1024 && exec bash /run.sh' + - "bash" + - "-c" + - "ulimit -n 1024 && exec bash /run.sh" diff --git a/server-ce/test/package.json b/server-ce/test/package.json index dc20715c6a..fc8b907fcc 100644 --- a/server-ce/test/package.json +++ b/server-ce/test/package.json @@ -6,8 +6,6 @@ "scripts": { "cypress:open": "cypress open --e2e --browser chrome", "cypress:run": "cypress run --e2e --browser chrome", - "format": "prettier --list-different $PWD/'**/*.{js,mjs,ts,tsx}'", - "format:fix": "prettier --write $PWD/'**/*.{js,mjs,ts,tsx}'", "lint": "eslint --max-warnings 0 --format unix --ext .js,.jsx,.mjs,.ts,.tsx .", "lint:fix": "eslint --fix --ext .js,.jsx,.mjs,.ts,.tsx ." }, diff --git a/services/chat/Makefile b/services/chat/Makefile index e66f606fe7..debd91a181 100644 --- a/services/chat/Makefile +++ b/services/chat/Makefile @@ -52,11 +52,10 @@ 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) node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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/chat/reports:/overleaf/services/chat/reports $(IMAGE_CI) npm run --silent - -# Same but from the top of the monorepo -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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/chat/reports:/overleaf/services/chat/reports -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -77,13 +76,13 @@ shellcheck_fix: done format: - $(RUN_LINTING) format + $(RUN_LINTING_MONOREPO) format -- services/chat format_ci: - $(RUN_LINTING_CI) format + $(RUN_LINTING_CI_MONOREPO) format -- services/chat format_fix: - $(RUN_LINTING) format:fix + $(RUN_LINTING_MONOREPO) format:fix -- services/chat lint: $(RUN_LINTING) lint diff --git a/services/chat/README.md b/services/chat/README.md index 8bbc0128a6..37c8bb91d6 100644 --- a/services/chat/README.md +++ b/services/chat/README.md @@ -1,10 +1,8 @@ -overleaf/chat -=============== +# overleaf/chat The backend API that powers the chat service in Overleaf -License -------- +## License The code in this repository is released under the GNU AFFERO GENERAL PUBLIC LICENSE, version 3. A copy can be found in the `LICENSE` file. diff --git a/services/chat/chat.yaml b/services/chat/chat.yaml index 1438706749..d0b8dc6ca3 100644 --- a/services/chat/chat.yaml +++ b/services/chat/chat.yaml @@ -3,12 +3,12 @@ x-stoplight: id: okoe8mh50pjec info: title: chat - version: '1.0' + version: "1.0" servers: - - url: 'http://chat:3010' + - url: "http://chat:3010" x-exegesis-controller: messagesController paths: - '/project/{projectId}/messages': + "/project/{projectId}/messages": parameters: - schema: type: string @@ -19,14 +19,14 @@ paths: summary: Get Global messages tags: [] responses: - '201': + "201": description: OK content: application/json: schema: type: array items: - $ref: '#/components/schemas/Message' + $ref: "#/components/schemas/Message" operationId: getGlobalMessages description: Get global messages for the project with Project ID provided parameters: @@ -42,21 +42,21 @@ paths: summary: Send Global message operationId: sendGlobalMessage responses: - '201': + "201": description: OK requestBody: content: application/json: schema: - $ref: '#/components/schemas/Message' + $ref: "#/components/schemas/Message" examples: example-1: value: user_id: string content: string - description: 'UserID and Content of the message to be posted. ' + description: "UserID and Content of the message to be posted. " description: Send global message for the project with Project ID provided - '/project/{projectId}/messages/{messageId}': + "/project/{projectId}/messages/{messageId}": parameters: - schema: type: string @@ -72,13 +72,13 @@ paths: summary: Get single global message tags: [] responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/Message' - '404': + $ref: "#/components/schemas/Message" + "404": description: Message not found operationId: getGlobalMessage description: Get a single global message by message ID for the project with Project ID provided @@ -86,10 +86,10 @@ paths: summary: Delete global message operationId: deleteGlobalMessage responses: - '204': + "204": description: No Content - description: 'Delete global message' - '/project/{projectId}/thread/{threadId}/messages': + description: "Delete global message" + "/project/{projectId}/thread/{threadId}/messages": parameters: - schema: type: string @@ -105,19 +105,19 @@ paths: summary: Send message operationId: sendMessage responses: - '201': + "201": description: Created description: Add a message to the thread with thread ID provided from the Project with Project ID provided. requestBody: content: application/json: schema: - $ref: '#/components/schemas/Message' + $ref: "#/components/schemas/Message" description: |- JSON object with : - user_id: Id of the user - content: Content of the message - '/project/{projectId}/threads': + "/project/{projectId}/threads": parameters: - schema: type: string @@ -128,20 +128,20 @@ paths: summary: Get Threads tags: [] responses: - '200': + "200": description: OK content: application/json: schema: type: array items: - $ref: '#/components/schemas/Thread' + $ref: "#/components/schemas/Thread" examples: {} - '404': + "404": description: Not Found operationId: getThreads description: Get the list of threads for the project with Project ID provided - '/project/{projectId}/thread/{threadId}/messages/{messageId}/edit': + "/project/{projectId}/thread/{threadId}/messages/{messageId}/edit": parameters: - schema: type: string @@ -162,9 +162,9 @@ paths: summary: Edit message operationId: editMessage responses: - '204': + "204": description: No Content - '404': + "404": description: Not Found requestBody: content: @@ -186,7 +186,7 @@ paths: - user_id: Id of the user (optional) description: | Update message with Message ID provided from the Thread ID and Project ID provided - '/project/{projectId}/messages/{messageId}/edit': + "/project/{projectId}/messages/{messageId}/edit": parameters: - schema: type: string @@ -202,9 +202,9 @@ paths: summary: Edit global message operationId: editGlobalMessage responses: - '204': + "204": description: No Content - '404': + "404": description: Not Found requestBody: content: @@ -226,7 +226,7 @@ paths: - user_id: Id of the user (optional) description: | Update global message with Message ID provided from the Project ID provided - '/project/{projectId}/thread/{threadId}/messages/{messageId}': + "/project/{projectId}/thread/{threadId}/messages/{messageId}": parameters: - schema: type: string @@ -247,13 +247,13 @@ paths: summary: Get thread message tags: [] responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/Message' - '404': + $ref: "#/components/schemas/Message" + "404": description: Message not found operationId: getThreadMessage description: Get a specific message by message ID from the thread with Thread ID and Project ID provided @@ -261,10 +261,10 @@ paths: summary: Delete message operationId: deleteMessage responses: - '204': + "204": description: No Content - description: 'Delete message with Message ID provided, from the Thread with ThreadID and ProjectID provided' - '/project/{projectId}/thread/{threadId}/user/{userId}/messages/{messageId}': + description: "Delete message with Message ID provided, from the Thread with ThreadID and ProjectID provided" + "/project/{projectId}/thread/{threadId}/user/{userId}/messages/{messageId}": parameters: - schema: type: string @@ -290,9 +290,9 @@ paths: summary: Delete message written by a given user operationId: deleteUserMessage responses: - '204': + "204": description: No Content - '/project/{projectId}/thread/{threadId}/resolve': + "/project/{projectId}/thread/{threadId}/resolve": parameters: - schema: type: string @@ -308,7 +308,7 @@ paths: summary: Resolve Thread operationId: resolveThread responses: - '204': + "204": description: No Content requestBody: content: @@ -324,7 +324,7 @@ paths: JSON object with : - user_id: Id of the user. description: Mark Thread with ThreadID and ProjectID provided owned by the user with UserID provided as resolved. - '/project/{projectId}/thread/{threadId}/reopen': + "/project/{projectId}/thread/{threadId}/reopen": parameters: - schema: type: string @@ -340,12 +340,12 @@ paths: summary: Reopen Thread operationId: reopenThread responses: - '204': + "204": description: No Content description: |- Reopen Thread with ThreadID and ProjectID provided. i.e unmark it as resolved. - '/project/{projectId}/thread/{threadId}': + "/project/{projectId}/thread/{threadId}": parameters: - schema: type: string @@ -361,13 +361,13 @@ paths: summary: Get Thread tags: [] responses: - '200': + "200": description: OK content: application/json: schema: - $ref: '#/components/schemas/Thread' - '404': + $ref: "#/components/schemas/Thread" + "404": description: Thread not found operationId: getThread description: Get a thread with ThreadID and ProjectID provided @@ -375,10 +375,10 @@ paths: summary: Delete thread operationId: deleteThread responses: - '204': + "204": description: No Content description: Delete thread with ThreadID and ProjectID provided - '/project/{projectId}/resolved-thread-ids': + "/project/{projectId}/resolved-thread-ids": parameters: - schema: type: string @@ -389,9 +389,9 @@ paths: summary: Get resolved thread ids operationId: getResolvedThreadIds responses: - '200': + "200": description: Resolved thread ids - '/project/{projectId}': + "/project/{projectId}": parameters: - schema: type: string @@ -402,15 +402,15 @@ paths: summary: Destroy project operationId: destroyProject responses: - '204': + "204": description: No Content - description: 'Delete all threads from Project with Project ID provided, and all messages in those threads.' + description: "Delete all threads from Project with Project ID provided, and all messages in those threads." /status: get: summary: Check status tags: [] responses: - '200': + "200": description: OK content: application/json: @@ -423,7 +423,7 @@ paths: summary: Check status tags: [] responses: - '200': + "200": description: OK content: application/json: @@ -432,7 +432,7 @@ paths: description: chat is alive operationId: getStatus description: Check that the Chat service is alive - '/project/{projectId}/duplicate-comment-threads': + "/project/{projectId}/duplicate-comment-threads": parameters: - schema: type: string @@ -453,7 +453,7 @@ paths: items: type: string responses: - '200': + "200": content: application/json: schema: @@ -463,7 +463,7 @@ paths: type: object description: Mapping of old thread ids to their duplicated thread ids description: Duplicate a list of comment threads - '/project/{projectId}/generate-thread-data': + "/project/{projectId}/generate-thread-data": parameters: - schema: type: string @@ -484,7 +484,7 @@ paths: items: type: string responses: - '200': + "200": content: application/json: schema: @@ -514,4 +514,4 @@ components: id: 0ppt3jw4h5bua type: array items: - $ref: '#/components/schemas/Message' + $ref: "#/components/schemas/Message" diff --git a/services/chat/docker-compose.ci.yml b/services/chat/docker-compose.ci.yml index 525f0c1267..18c28b0321 100644 --- a/services/chat/docker-compose.ci.yml +++ b/services/chat/docker-compose.ci.yml @@ -20,7 +20,6 @@ services: mongo: condition: service_started - test_acceptance: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -41,7 +40,6 @@ services: entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 -- command: npm run test:acceptance - tar: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -49,6 +47,7 @@ services: - ./:/tmp/build/ command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs . user: root + mongo: image: mongo:8.0.11 command: --replSet overleaf --notablescan diff --git a/services/chat/docker-compose.yml b/services/chat/docker-compose.yml index bb2c351543..ca8ba2a5d6 100644 --- a/services/chat/docker-compose.yml +++ b/services/chat/docker-compose.yml @@ -62,4 +62,3 @@ services: # replica set. This override is not needed when running the setup after # starting up mongo. - mongo:127.0.0.1 - diff --git a/services/chat/package.json b/services/chat/package.json index 3817311e6a..262215bf8c 100644 --- a/services/chat/package.json +++ b/services/chat/package.json @@ -12,8 +12,6 @@ "test:acceptance:_run": "mocha --recursive --timeout 15000 --exit $@ test/acceptance/js", "test:unit:_run": "mocha --recursive --exit $@ test/unit/js", "lint": "eslint --max-warnings 0 --format unix .", - "format": "prettier --list-different $PWD/'**/{*.*js,*.ts}'", - "format:fix": "prettier --write $PWD/'**/{*.*js,*.ts}'", "lint:fix": "eslint --fix .", "types:check": "tsc --noEmit" }, diff --git a/services/clsi/Makefile b/services/clsi/Makefile index 5e8e34ed68..62121851e2 100644 --- a/services/clsi/Makefile +++ b/services/clsi/Makefile @@ -52,11 +52,10 @@ 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) node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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/clsi/reports:/overleaf/services/clsi/reports $(IMAGE_CI) npm run --silent - -# Same but from the top of the monorepo -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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/clsi/reports:/overleaf/services/clsi/reports -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -77,13 +76,13 @@ shellcheck_fix: done format: - $(RUN_LINTING) format + $(RUN_LINTING_MONOREPO) format -- services/clsi format_ci: - $(RUN_LINTING_CI) format + $(RUN_LINTING_CI_MONOREPO) format -- services/clsi format_fix: - $(RUN_LINTING) format:fix + $(RUN_LINTING_MONOREPO) format:fix -- services/clsi lint: $(RUN_LINTING) lint diff --git a/services/clsi/docker-compose.ci.yml b/services/clsi/docker-compose.ci.yml index 5c7d736d55..a049e9798c 100644 --- a/services/clsi/docker-compose.ci.yml +++ b/services/clsi/docker-compose.ci.yml @@ -16,7 +16,6 @@ services: NODE_OPTIONS: "--unhandled-rejections=strict" VITEST_NO_CACHE: true - test_acceptance: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -43,7 +42,6 @@ services: - /var/run/docker.sock:/var/run/docker.sock command: npm run test:acceptance - tar: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER diff --git a/services/clsi/docker-compose.yml b/services/clsi/docker-compose.yml index df0dd0ce36..f62074431e 100644 --- a/services/clsi/docker-compose.yml +++ b/services/clsi/docker-compose.yml @@ -51,4 +51,3 @@ services: SANDBOXED_COMPILES_HOST_DIR_COMPILES: $PWD/compiles SANDBOXED_COMPILES_HOST_DIR_OUTPUT: $PWD/output command: npm run --silent test:acceptance - diff --git a/services/clsi/package.json b/services/clsi/package.json index 3052d74ccf..3f1868ec8e 100644 --- a/services/clsi/package.json +++ b/services/clsi/package.json @@ -12,8 +12,6 @@ "test:unit": "npm run test:unit:_run", "nodemon": "node --watch app.js", "lint": "eslint --max-warnings 0 --format unix .", - "format": "prettier --list-different $PWD/'**/{*.*js,*.ts}'", - "format:fix": "prettier --write $PWD/'**/{*.*js,*.ts}'", "lint:fix": "eslint --fix .", "types:check": "tsc --noEmit" }, diff --git a/services/clsi/test/acceptance/fixtures/examples/draft_legacy/options.json b/services/clsi/test/acceptance/fixtures/examples/draft_legacy/options.json index 183ed4b628..c9f72b70cf 100644 --- a/services/clsi/test/acceptance/fixtures/examples/draft_legacy/options.json +++ b/services/clsi/test/acceptance/fixtures/examples/draft_legacy/options.json @@ -1,3 +1,3 @@ { "draft": true -} \ No newline at end of file +} diff --git a/services/clsi/test/acceptance/fixtures/examples/draft_mode/options.json b/services/clsi/test/acceptance/fixtures/examples/draft_mode/options.json index 183ed4b628..c9f72b70cf 100644 --- a/services/clsi/test/acceptance/fixtures/examples/draft_mode/options.json +++ b/services/clsi/test/acceptance/fixtures/examples/draft_mode/options.json @@ -1,3 +1,3 @@ { "draft": true -} \ No newline at end of file +} diff --git a/services/clsi/test/acceptance/fixtures/examples/feynmp/options.json b/services/clsi/test/acceptance/fixtures/examples/feynmp/options.json index a280541cfe..459c6dbaf4 100644 --- a/services/clsi/test/acceptance/fixtures/examples/feynmp/options.json +++ b/services/clsi/test/acceptance/fixtures/examples/feynmp/options.json @@ -1,3 +1,3 @@ { - "compiler": "latex" + "compiler": "latex" } diff --git a/services/clsi/test/acceptance/fixtures/examples/fontawesome_xelatex/options.json b/services/clsi/test/acceptance/fixtures/examples/fontawesome_xelatex/options.json index a2e0c09897..1b04fd78de 100644 --- a/services/clsi/test/acceptance/fixtures/examples/fontawesome_xelatex/options.json +++ b/services/clsi/test/acceptance/fixtures/examples/fontawesome_xelatex/options.json @@ -1,3 +1,3 @@ { - "compiler": "xelatex" + "compiler": "xelatex" } diff --git a/services/clsi/test/acceptance/fixtures/examples/latex_compiler/options.json b/services/clsi/test/acceptance/fixtures/examples/latex_compiler/options.json index a280541cfe..459c6dbaf4 100644 --- a/services/clsi/test/acceptance/fixtures/examples/latex_compiler/options.json +++ b/services/clsi/test/acceptance/fixtures/examples/latex_compiler/options.json @@ -1,3 +1,3 @@ { - "compiler": "latex" + "compiler": "latex" } diff --git a/services/clsi/test/acceptance/fixtures/examples/lualatex_compiler/options.json b/services/clsi/test/acceptance/fixtures/examples/lualatex_compiler/options.json index 96a05433b3..2a4b2b7801 100644 --- a/services/clsi/test/acceptance/fixtures/examples/lualatex_compiler/options.json +++ b/services/clsi/test/acceptance/fixtures/examples/lualatex_compiler/options.json @@ -1,3 +1,3 @@ { - "compiler": "lualatex" + "compiler": "lualatex" } diff --git a/services/clsi/test/acceptance/fixtures/examples/tikz_feynman/options.json b/services/clsi/test/acceptance/fixtures/examples/tikz_feynman/options.json index 96a05433b3..2a4b2b7801 100644 --- a/services/clsi/test/acceptance/fixtures/examples/tikz_feynman/options.json +++ b/services/clsi/test/acceptance/fixtures/examples/tikz_feynman/options.json @@ -1,3 +1,3 @@ { - "compiler": "lualatex" + "compiler": "lualatex" } diff --git a/services/clsi/test/acceptance/fixtures/examples/xelatex_compiler/options.json b/services/clsi/test/acceptance/fixtures/examples/xelatex_compiler/options.json index a2e0c09897..1b04fd78de 100644 --- a/services/clsi/test/acceptance/fixtures/examples/xelatex_compiler/options.json +++ b/services/clsi/test/acceptance/fixtures/examples/xelatex_compiler/options.json @@ -1,3 +1,3 @@ { - "compiler": "xelatex" + "compiler": "xelatex" } diff --git a/services/contacts/Makefile b/services/contacts/Makefile index 10dfa44dff..2dc973da52 100644 --- a/services/contacts/Makefile +++ b/services/contacts/Makefile @@ -52,11 +52,10 @@ 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) node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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/contacts/reports:/overleaf/services/contacts/reports $(IMAGE_CI) npm run --silent - -# Same but from the top of the monorepo -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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/contacts/reports:/overleaf/services/contacts/reports -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -77,13 +76,13 @@ shellcheck_fix: done format: - $(RUN_LINTING) format + $(RUN_LINTING_MONOREPO) format -- services/contacts format_ci: - $(RUN_LINTING_CI) format + $(RUN_LINTING_CI_MONOREPO) format -- services/contacts format_fix: - $(RUN_LINTING) format:fix + $(RUN_LINTING_MONOREPO) format:fix -- services/contacts lint: $(RUN_LINTING) lint diff --git a/services/contacts/README.md b/services/contacts/README.md index 5d84152241..020015b8a1 100644 --- a/services/contacts/README.md +++ b/services/contacts/README.md @@ -1,10 +1,8 @@ -overleaf/contacts -=================== +# overleaf/contacts An API for tracking contacts of a user -License -------- +## License The code in this repository is released under the GNU AFFERO GENERAL PUBLIC LICENSE, version 3. A copy can be found in the `LICENSE` file. diff --git a/services/contacts/docker-compose.ci.yml b/services/contacts/docker-compose.ci.yml index 93181a3e58..6db5bd7663 100644 --- a/services/contacts/docker-compose.ci.yml +++ b/services/contacts/docker-compose.ci.yml @@ -20,7 +20,6 @@ services: mongo: condition: service_started - test_acceptance: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -41,7 +40,6 @@ services: entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 -- command: npm run test:acceptance - tar: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -49,6 +47,7 @@ services: - ./:/tmp/build/ command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs . user: root + mongo: image: mongo:8.0.11 command: --replSet overleaf --notablescan diff --git a/services/contacts/docker-compose.yml b/services/contacts/docker-compose.yml index 9ba5e8bc2e..328417a564 100644 --- a/services/contacts/docker-compose.yml +++ b/services/contacts/docker-compose.yml @@ -62,4 +62,3 @@ services: # replica set. This override is not needed when running the setup after # starting up mongo. - mongo:127.0.0.1 - diff --git a/services/contacts/package.json b/services/contacts/package.json index 0b8cbc07cb..89da0dae5d 100644 --- a/services/contacts/package.json +++ b/services/contacts/package.json @@ -12,8 +12,6 @@ "test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP", "nodemon": "node --watch app.js", "lint": "eslint --max-warnings 0 --format unix .", - "format": "prettier --list-different $PWD/'**/{*.*js,*.ts}'", - "format:fix": "prettier --write $PWD/'**/{*.*js,*.ts}'", "lint:fix": "eslint --fix .", "types:check": "tsc --noEmit" }, diff --git a/services/docstore/Makefile b/services/docstore/Makefile index c4d74f4c2e..f17c779aad 100644 --- a/services/docstore/Makefile +++ b/services/docstore/Makefile @@ -54,11 +54,10 @@ 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) node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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/docstore/reports:/overleaf/services/docstore/reports $(IMAGE_CI) npm run --silent - -# Same but from the top of the monorepo -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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/docstore/reports:/overleaf/services/docstore/reports -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -79,13 +78,13 @@ shellcheck_fix: done format: - $(RUN_LINTING) format + $(RUN_LINTING_MONOREPO) format -- services/docstore format_ci: - $(RUN_LINTING_CI) format + $(RUN_LINTING_CI_MONOREPO) format -- services/docstore format_fix: - $(RUN_LINTING) format:fix + $(RUN_LINTING_MONOREPO) format:fix -- services/docstore lint: $(RUN_LINTING) lint diff --git a/services/docstore/README.md b/services/docstore/README.md index 09b27ac25a..33104743cf 100644 --- a/services/docstore/README.md +++ b/services/docstore/README.md @@ -1,10 +1,8 @@ -overleaf/docstore -=================== +# overleaf/docstore A CRUD API for storing and updating text documents in projects -License -------- +## License The code in this repository is released under the GNU AFFERO GENERAL PUBLIC LICENSE, version 3. A copy can be found in the `LICENSE` file. diff --git a/services/docstore/docker-compose.ci.yml b/services/docstore/docker-compose.ci.yml index bfc05bc8b9..19c3b8fe73 100644 --- a/services/docstore/docker-compose.ci.yml +++ b/services/docstore/docker-compose.ci.yml @@ -22,7 +22,6 @@ services: mongo: condition: service_started - test_acceptance: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -48,7 +47,6 @@ services: entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 -- command: npm run test:acceptance - tar: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -56,6 +54,7 @@ services: - ./:/tmp/build/ command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs . user: root + mongo: image: mongo:8.0.11 command: --replSet overleaf --notablescan @@ -70,6 +69,7 @@ services: # replica set. This override is not needed when running the setup after # starting up mongo. - mongo:127.0.0.1 + gcs: image: fsouza/fake-gcs-server:1.52.3 command: ["--port=9090", "--scheme=http", "--external-url=http://gcs:9090"] diff --git a/services/docstore/package.json b/services/docstore/package.json index e672eb5951..5b11ef3941 100644 --- a/services/docstore/package.json +++ b/services/docstore/package.json @@ -12,8 +12,6 @@ "test:unit": "npm run test:unit:_run", "nodemon": "node --watch app.js", "lint": "eslint --max-warnings 0 --format unix .", - "format": "prettier --list-different $PWD/'**/{*.*js,*.ts}'", - "format:fix": "prettier --write $PWD/'**/{*.*js,*.ts}'", "lint:fix": "eslint --fix .", "types:check": "tsc --noEmit" }, diff --git a/services/document-updater/Makefile b/services/document-updater/Makefile index 673cbd0a36..3607a2825c 100644 --- a/services/document-updater/Makefile +++ b/services/document-updater/Makefile @@ -55,11 +55,10 @@ 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) node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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/document-updater/reports:/overleaf/services/document-updater/reports $(IMAGE_CI) npm run --silent - -# Same but from the top of the monorepo -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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/document-updater/reports:/overleaf/services/document-updater/reports -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -80,13 +79,13 @@ shellcheck_fix: done format: - $(RUN_LINTING) format + $(RUN_LINTING_MONOREPO) format -- services/document-updater format_ci: - $(RUN_LINTING_CI) format + $(RUN_LINTING_CI_MONOREPO) format -- services/document-updater format_fix: - $(RUN_LINTING) format:fix + $(RUN_LINTING_MONOREPO) format:fix -- services/document-updater lint: $(RUN_LINTING) lint diff --git a/services/document-updater/README.md b/services/document-updater/README.md index 2e6f0003a5..d11590e432 100644 --- a/services/document-updater/README.md +++ b/services/document-updater/README.md @@ -1,12 +1,9 @@ -overleaf/document-updater -=========================== +# overleaf/document-updater An API for applying incoming updates to documents in real-time. -License -------- +## License The code in this repository is released under the GNU AFFERO GENERAL PUBLIC LICENSE, version 3. A copy can be found in the `LICENSE` file. Copyright (c) Overleaf, 2014-2019. - diff --git a/services/document-updater/app/js/sharejs/README.md b/services/document-updater/app/js/sharejs/README.md index f5919dd9c1..c71456550a 100644 --- a/services/document-updater/app/js/sharejs/README.md +++ b/services/document-updater/app/js/sharejs/README.md @@ -3,4 +3,3 @@ This folder contains a modified version of the ShareJS source code, forked from The original CoffeeScript code has been decaffeinated to JavaScript, and further modified. Some folders have been removed. See https://github.com/josephg/ShareJS/blob/v0.5.0/src/types/README.md for the original README. The original code, and the current modified code in this directory, are published under the MIT license. - diff --git a/services/document-updater/app/js/sharejs/types/README.md b/services/document-updater/app/js/sharejs/types/README.md index 22e68842dd..f8de3cb219 100644 --- a/services/document-updater/app/js/sharejs/types/README.md +++ b/services/document-updater/app/js/sharejs/types/README.md @@ -3,7 +3,6 @@ This directory contains all the operational transform code. Each file defines a Most of the types in here are for testing or demonstration. The only types which are sent to the webclient are `text` and `json`. - # An OT type All OT types have the following fields: @@ -18,7 +17,6 @@ Given op1, op2, `apply(s, op2, transform(op1, op2, 'left')) == apply(s, op1, tra Transform and apply must never modify their arguments. - Optional properties: `tp2`: _(bool)_ True if the transform function supports TP2. This allows p2p architectures to work. @@ -29,14 +27,12 @@ Optional properties: `normalize(op) -> op`: Fix up an op to make it valid. Eg, remove skips of size zero. `api`: _(object)_ Set of helper methods which will be mixed in to the client document object for manipulating documents. See below. - # Examples `count` and `simple` are two trivial OT type definitions if you want to take a look. JSON defines the ot-for-JSON type (see the wiki for documentation) and all the text types define different text implementations. (I still have no idea which one I like the most, and they're fun to write!) - # API Types can also define API functions. These methods are mixed into the client's Doc object when a document is created. diff --git a/services/document-updater/docker-compose.ci.yml b/services/document-updater/docker-compose.ci.yml index e983f7c2e6..f66c69415f 100644 --- a/services/document-updater/docker-compose.ci.yml +++ b/services/document-updater/docker-compose.ci.yml @@ -27,7 +27,6 @@ services: redis_test: condition: service_healthy - test_acceptance: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -55,7 +54,6 @@ services: entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 -- command: npm run test:acceptance - tar: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -63,6 +61,7 @@ services: - ./:/tmp/build/ command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs . user: root + redis_test: image: redis:7.4.3 healthcheck: diff --git a/services/document-updater/docker-compose.yml b/services/document-updater/docker-compose.yml index 473f88842e..31a7d019d8 100644 --- a/services/document-updater/docker-compose.yml +++ b/services/document-updater/docker-compose.yml @@ -83,4 +83,3 @@ services: # replica set. This override is not needed when running the setup after # starting up mongo. - mongo:127.0.0.1 - diff --git a/services/document-updater/package.json b/services/document-updater/package.json index a1e0e03c28..f68e43a576 100644 --- a/services/document-updater/package.json +++ b/services/document-updater/package.json @@ -12,8 +12,6 @@ "nodemon": "node --watch app.js", "benchmark:apply": "node benchmarks/apply", "lint": "eslint --max-warnings 0 --format unix .", - "format": "prettier --list-different $PWD/'**/{*.*js,*.ts}'", - "format:fix": "prettier --write $PWD/'**/{*.*js,*.ts}'", "lint:fix": "eslint --fix .", "types:check": "tsc --noEmit" }, diff --git a/services/filestore/.prettierignore b/services/filestore/.prettierignore deleted file mode 100644 index 3c3629e647..0000000000 --- a/services/filestore/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/services/filestore/Makefile b/services/filestore/Makefile index e381e1575b..b6f79ecd40 100644 --- a/services/filestore/Makefile +++ b/services/filestore/Makefile @@ -52,11 +52,10 @@ 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) node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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 $(IMAGE_CI) npm run --silent - -# Same but from the top of the monorepo -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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 -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -77,13 +76,13 @@ shellcheck_fix: done format: - $(RUN_LINTING) format + $(RUN_LINTING_MONOREPO) format -- services/filestore format_ci: - $(RUN_LINTING_CI) format + $(RUN_LINTING_CI_MONOREPO) format -- services/filestore format_fix: - $(RUN_LINTING) format:fix + $(RUN_LINTING_MONOREPO) format:fix -- services/filestore lint: $(RUN_LINTING) lint diff --git a/services/filestore/README.md b/services/filestore/README.md index 921fb4b76e..f3da2d2819 100644 --- a/services/filestore/README.md +++ b/services/filestore/README.md @@ -1,21 +1,19 @@ -overleaf/filestore -==================== +# overleaf/filestore An API for CRUD operations on binary files stored in S3 filestore acts as a proxy between the CLSIs and (currently) Amazon S3 storage, presenting a RESTful HTTP interface to the CLSIs on port 3009 by default. Urls are mapped to node functions in https://github.com/overleaf/filestore/blob/master/app.coffee . URLs are of the form: -* `/project/:project_id/file/:file_id` -* `/template/:template_id/v/:version/:format` -* `/project/:project_id/public/:public_file_id` -* `/project/:project_id/size` -* `/bucket/:bucket/key/*` -* `/shutdown` -* `/status` - returns HTTP 200 `filestore is up` or HTTP 503 when shutting down -* `/health_check` +- `/project/:project_id/file/:file_id` +- `/template/:template_id/v/:version/:format` +- `/project/:project_id/public/:public_file_id` +- `/project/:project_id/size` +- `/bucket/:bucket/key/*` +- `/shutdown` +- `/status` - returns HTTP 200 `filestore is up` or HTTP 503 when shutting down +- `/health_check` -License -------- +## License The code in this repository is released under the GNU AFFERO GENERAL PUBLIC LICENSE, version 3. A copy can be found in the `LICENSE` file. diff --git a/services/filestore/docker-compose.ci.yml b/services/filestore/docker-compose.ci.yml index d60b765c4a..4b3100fa46 100644 --- a/services/filestore/docker-compose.ci.yml +++ b/services/filestore/docker-compose.ci.yml @@ -20,7 +20,6 @@ services: NODE_OPTIONS: "--unhandled-rejections=strict" VITEST_NO_CACHE: true - test_acceptance: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -29,7 +28,7 @@ services: MONGO_HOST: mongo POSTGRES_HOST: postgres AWS_S3_ENDPOINT: https://minio:9000 - AWS_S3_PATH_STYLE: 'true' + AWS_S3_PATH_STYLE: "true" DELETE_OBJECTS_MD5_FALLBACK: true AWS_ACCESS_KEY_ID: OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY: OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY @@ -64,7 +63,6 @@ services: user: node command: npm run test:acceptance - tar: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -72,6 +70,7 @@ services: - ./:/tmp/build/ command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs . user: root + certs: build: dockerfile_inline: | @@ -83,7 +82,7 @@ services: working_dir: /certs entrypoint: sh command: - - '-cex' + - "-cex" - | if [ ! -f private.key ] || [ ! -f public.crt ]; then /certgen -host minio @@ -115,7 +114,7 @@ services: - minio-certs:/root/.mc/certs/CAs entrypoint: sh command: - - '-cex' + - "-cex" - | sleep 1 mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD \ @@ -218,6 +217,7 @@ services: mc admin policy create s3 overleaf-filestore policy-filestore.json mc admin policy attach s3 overleaf-filestore \ --user=OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID + gcs: image: fsouza/fake-gcs-server:1.52.3 command: ["--port=9090", "--scheme=http", "--external-url=http://gcs:9090"] diff --git a/services/filestore/docker-compose.yml b/services/filestore/docker-compose.yml index fc24ce2f66..8f2f591bc8 100644 --- a/services/filestore/docker-compose.yml +++ b/services/filestore/docker-compose.yml @@ -41,7 +41,7 @@ services: MONGO_CONNECTION_STRING: mongodb://mongo/test-overleaf POSTGRES_HOST: postgres AWS_S3_ENDPOINT: https://minio:9000 - AWS_S3_PATH_STYLE: 'true' + AWS_S3_PATH_STYLE: "true" DELETE_OBJECTS_MD5_FALLBACK: true AWS_ACCESS_KEY_ID: OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY: OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY @@ -85,7 +85,7 @@ services: working_dir: /certs entrypoint: sh command: - - '-cex' + - "-cex" - | if [ ! -f private.key ] || [ ! -f public.crt ]; then /certgen -host minio @@ -117,7 +117,7 @@ services: - minio-certs:/root/.mc/certs/CAs entrypoint: sh command: - - '-cex' + - "-cex" - | sleep 1 mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD \ @@ -220,6 +220,7 @@ services: mc admin policy create s3 overleaf-filestore policy-filestore.json mc admin policy attach s3 overleaf-filestore \ --user=OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID + gcs: image: fsouza/fake-gcs-server:1.52.3 command: ["--port=9090", "--scheme=http", "--external-url=http://gcs:9090"] diff --git a/services/filestore/package.json b/services/filestore/package.json index 0f7f444e40..0e825c5254 100644 --- a/services/filestore/package.json +++ b/services/filestore/package.json @@ -12,8 +12,6 @@ "start": "node app.js", "nodemon": "node --watch app.js", "lint": "eslint --max-warnings 0 --format unix .", - "format": "prettier --list-different $PWD/'**/{*.*js,*.ts}'", - "format:fix": "prettier --write $PWD/'**/{*.*js,*.ts}'", "test:acceptance:_run": "mocha --recursive --timeout 15000 --exit $@ test/acceptance/js", "test:unit:_run": "vitest --config ./vitest.config.unit.cjs", "lint:fix": "eslint --fix .", diff --git a/services/git-bridge/README.md b/services/git-bridge/README.md index eadc2abc4f..2c9749b678 100644 --- a/services/git-bridge/README.md +++ b/services/git-bridge/README.md @@ -3,7 +3,7 @@ ## Docker The `Dockerfile` contains all the requirements for building and running the - writelatex-git-bridge. +writelatex-git-bridge. ```bash # build the image @@ -17,8 +17,8 @@ docker run -v `pwd`/conf/local.json:/conf/runtime.json writelatex-git-bridge ### Required packages - * `maven` (for building, running tests and packaging) - * `jdk-8` (for compiling and running) +- `maven` (for building, running tests and packaging) +- `jdk-8` (for compiling and running) ### Commands @@ -114,7 +114,6 @@ The configuration file is in `.json` format. You have to restart the server for configuration changes to take effect. - ## Creating OAuth app In dev-env, run the following command in mongo to create the oauth application diff --git a/services/git-bridge/conf/example_config.json b/services/git-bridge/conf/example_config.json index 76b82eb6a0..eafe3c62f7 100644 --- a/services/git-bridge/conf/example_config.json +++ b/services/git-bridge/conf/example_config.json @@ -1,30 +1,30 @@ { - "port": 8080, - "bindIp": "127.0.0.1", - "idleTimeout": 30000, - "rootGitDirectory": "/tmp/wlgb", - "allowedCorsOrigins": "https://localhost", - "apiBaseUrl": "https://localhost/api/v0", - "postbackBaseUrl": "https://localhost", - "serviceName": "Overleaf", - "oauth2Server": "https://localhost", - "repoStore": { - "maxFileNum": 2000, - "maxFileSize": 52428800 - }, - "swapStore": { - "type": "s3", - "awsAccessKey": "asdf", - "awsSecret": "asdf", - "s3BucketName": "com.overleaf.testbucket", - "awsRegion": "us-east-1" - }, - "swapJob": { - "minProjects": 50, - "lowGiB": 128, - "highGiB": 256, - "intervalMillis": 3600000, - "compressionMethod": "gzip" - }, - "sqliteHeapLimitBytes": 512000000 + "port": 8080, + "bindIp": "127.0.0.1", + "idleTimeout": 30000, + "rootGitDirectory": "/tmp/wlgb", + "allowedCorsOrigins": "https://localhost", + "apiBaseUrl": "https://localhost/api/v0", + "postbackBaseUrl": "https://localhost", + "serviceName": "Overleaf", + "oauth2Server": "https://localhost", + "repoStore": { + "maxFileNum": 2000, + "maxFileSize": 52428800 + }, + "swapStore": { + "type": "s3", + "awsAccessKey": "asdf", + "awsSecret": "asdf", + "s3BucketName": "com.overleaf.testbucket", + "awsRegion": "us-east-1" + }, + "swapJob": { + "minProjects": 50, + "lowGiB": 128, + "highGiB": 256, + "intervalMillis": 3600000, + "compressionMethod": "gzip" + }, + "sqliteHeapLimitBytes": 512000000 } diff --git a/services/history-v1/Makefile b/services/history-v1/Makefile index 6642b2609c..3690119cf2 100644 --- a/services/history-v1/Makefile +++ b/services/history-v1/Makefile @@ -57,11 +57,10 @@ 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) node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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 $(IMAGE_CI) npm run --silent - -# Same but from the top of the monorepo -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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 -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -82,13 +81,13 @@ shellcheck_fix: done format: - $(RUN_LINTING) format + $(RUN_LINTING_MONOREPO) format -- services/history-v1 format_ci: - $(RUN_LINTING_CI) format + $(RUN_LINTING_CI_MONOREPO) format -- services/history-v1 format_fix: - $(RUN_LINTING) format:fix + $(RUN_LINTING_MONOREPO) format:fix -- services/history-v1 lint: $(RUN_LINTING) lint diff --git a/services/history-v1/README.md b/services/history-v1/README.md index 9591159ff0..af9c717265 100644 --- a/services/history-v1/README.md +++ b/services/history-v1/README.md @@ -3,11 +3,13 @@ The history service uses knex to manage PostgreSQL migrations. To create a new migrations, run: + ``` npx knex migrate:make migration_name ``` To apply migrations, run: + ``` npx knex migrate:latest ``` diff --git a/services/history-v1/config/custom-environment-variables.json b/services/history-v1/config/custom-environment-variables.json index 686ca25407..17988c4e4d 100644 --- a/services/history-v1/config/custom-environment-variables.json +++ b/services/history-v1/config/custom-environment-variables.json @@ -59,10 +59,10 @@ "zipTimeoutMs": "ZIP_STORE_ZIP_TIMEOUT_MS" }, "backupStore": { - "chunksBucket":"BACKUP_OVERLEAF_EDITOR_CHUNKS_BUCKET", - "deksBucket":"BACKUP_OVERLEAF_EDITOR_DEKS_BUCKET", - "globalBlobsBucket":"BACKUP_OVERLEAF_EDITOR_GLOBAL_BLOBS_BUCKET", - "projectBlobsBucket":"BACKUP_OVERLEAF_EDITOR_PROJECT_BLOBS_BUCKET" + "chunksBucket": "BACKUP_OVERLEAF_EDITOR_CHUNKS_BUCKET", + "deksBucket": "BACKUP_OVERLEAF_EDITOR_DEKS_BUCKET", + "globalBlobsBucket": "BACKUP_OVERLEAF_EDITOR_GLOBAL_BLOBS_BUCKET", + "projectBlobsBucket": "BACKUP_OVERLEAF_EDITOR_PROJECT_BLOBS_BUCKET" }, "healthCheckBlobs": "HEALTH_CHECK_BLOBS", "healthCheckProjects": "HEALTH_CHECK_PROJECTS", diff --git a/services/history-v1/config/development.json b/services/history-v1/config/development.json index 9cd73c62c1..92af760523 100644 --- a/services/history-v1/config/development.json +++ b/services/history-v1/config/development.json @@ -24,10 +24,10 @@ "bucket": "overleaf-development-zips" }, "backupStore": { - "chunksBucket":"overleaf-development-history-chunks", - "deksBucket":"overleaf-development-history-deks", - "globalBlobsBucket":"overleaf-development-history-global-blobs", - "projectBlobsBucket":"overleaf-development-history-project-blobs" + "chunksBucket": "overleaf-development-history-chunks", + "deksBucket": "overleaf-development-history-deks", + "globalBlobsBucket": "overleaf-development-history-global-blobs", + "projectBlobsBucket": "overleaf-development-history-project-blobs" }, "backupPersistor": { "keyEncryptionKeys": "[{\"key\":\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\",\"salt\":\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\"}]", diff --git a/services/history-v1/config/test.json b/services/history-v1/config/test.json index c38e28e564..82f3360129 100644 --- a/services/history-v1/config/test.json +++ b/services/history-v1/config/test.json @@ -22,10 +22,10 @@ "bucket": "overleaf-test-zips" }, "backupStore": { - "chunksBucket":"overleaf-test-history-chunks", - "deksBucket":"overleaf-test-history-deks", - "globalBlobsBucket":"overleaf-test-history-global-blobs", - "projectBlobsBucket":"overleaf-test-history-project-blobs" + "chunksBucket": "overleaf-test-history-chunks", + "deksBucket": "overleaf-test-history-deks", + "globalBlobsBucket": "overleaf-test-history-global-blobs", + "projectBlobsBucket": "overleaf-test-history-project-blobs" }, "backupPersistor": { "keyEncryptionKeys": "[{\"key\":\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\",\"salt\":\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\"}]", diff --git a/services/history-v1/docker-compose.ci.yml b/services/history-v1/docker-compose.ci.yml index 9e91a0e442..3e2ab0d32b 100644 --- a/services/history-v1/docker-compose.ci.yml +++ b/services/history-v1/docker-compose.ci.yml @@ -30,7 +30,6 @@ services: redis_test: condition: service_healthy - test_acceptance: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -44,7 +43,7 @@ services: MONGO_HOST: mongo POSTGRES_HOST: postgres AWS_S3_ENDPOINT: https://minio:9000 - AWS_S3_PATH_STYLE: 'true' + AWS_S3_PATH_STYLE: "true" DELETE_OBJECTS_MD5_FALLBACK: true AWS_ACCESS_KEY_ID: OVERLEAF_HISTORY_S3_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY: OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY @@ -79,7 +78,6 @@ services: entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 -- command: npm run test:acceptance - tar: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -87,6 +85,7 @@ services: - ./:/tmp/build/ command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs . user: root + redis_test: image: redis:7.4.3 healthcheck: @@ -108,6 +107,7 @@ services: # replica set. This override is not needed when running the setup after # starting up mongo. - mongo:127.0.0.1 + postgres: image: postgres:10 environment: @@ -132,7 +132,7 @@ services: working_dir: /certs entrypoint: sh command: - - '-cex' + - "-cex" - | if [ ! -f private.key ] || [ ! -f public.crt ]; then /certgen -host minio @@ -164,7 +164,7 @@ services: - minio-certs:/root/.mc/certs/CAs entrypoint: sh command: - - '-cex' + - "-cex" - | sleep 1 mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD \ @@ -267,6 +267,7 @@ services: mc admin policy create s3 overleaf-history policy-history.json mc admin policy attach s3 overleaf-history \ --user=OVERLEAF_HISTORY_S3_ACCESS_KEY_ID + gcs: image: fsouza/fake-gcs-server:1.52.3 command: ["--port=9090", "--scheme=http", "--external-url=http://gcs:9090"] diff --git a/services/history-v1/docker-compose.yml b/services/history-v1/docker-compose.yml index 9448717549..60233e7b34 100644 --- a/services/history-v1/docker-compose.yml +++ b/services/history-v1/docker-compose.yml @@ -60,7 +60,7 @@ services: MONGO_CONNECTION_STRING: mongodb://mongo/test-overleaf POSTGRES_HOST: postgres AWS_S3_ENDPOINT: https://minio:9000 - AWS_S3_PATH_STYLE: 'true' + AWS_S3_PATH_STYLE: "true" DELETE_OBJECTS_MD5_FALLBACK: true AWS_ACCESS_KEY_ID: OVERLEAF_HISTORY_S3_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY: OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY @@ -138,7 +138,7 @@ services: working_dir: /certs entrypoint: sh command: - - '-cex' + - "-cex" - | if [ ! -f private.key ] || [ ! -f public.crt ]; then /certgen -host minio @@ -170,7 +170,7 @@ services: - minio-certs:/root/.mc/certs/CAs entrypoint: sh command: - - '-cex' + - "-cex" - | sleep 1 mc alias set s3 https://minio:9000 MINIO_ROOT_USER MINIO_ROOT_PASSWORD \ @@ -273,6 +273,7 @@ services: mc admin policy create s3 overleaf-history policy-history.json mc admin policy attach s3 overleaf-history \ --user=OVERLEAF_HISTORY_S3_ACCESS_KEY_ID + gcs: image: fsouza/fake-gcs-server:1.52.3 command: ["--port=9090", "--scheme=http", "--external-url=http://gcs:9090"] diff --git a/services/history-v1/package.json b/services/history-v1/package.json index b93fed28bd..24809d1efb 100644 --- a/services/history-v1/package.json +++ b/services/history-v1/package.json @@ -64,8 +64,6 @@ "start": "node app.js", "lint": "eslint --max-warnings 0 --format unix .", "lint:fix": "eslint --fix .", - "format": "prettier --list-different $PWD/'**/{*.*js,*.ts}'", - "format:fix": "prettier --write $PWD/'**/{*.*js,*.ts}'", "test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP", "test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP", "test:unit:_run": "mocha --recursive --exit $@ test/unit/js", diff --git a/services/history-v1/storage/scripts/global-blobs-db-cleanup/README.md b/services/history-v1/storage/scripts/global-blobs-db-cleanup/README.md index 7460d4d6fd..cd3f91a158 100644 --- a/services/history-v1/storage/scripts/global-blobs-db-cleanup/README.md +++ b/services/history-v1/storage/scripts/global-blobs-db-cleanup/README.md @@ -1,9 +1,9 @@ Scripts in this directory were used when we cleaned up the global blobs table, ensuring that it only contained global blobs. The scripts are meant to be run in this order: -* `01-create-blob-hashes-table.sql` -* `02-set-global-flag.sql` -* `03-create-global-blobs-table.sql` -* `04-swap-global-blob-tables.sql` +- `01-create-blob-hashes-table.sql` +- `02-set-global-flag.sql` +- `03-create-global-blobs-table.sql` +- `04-swap-global-blob-tables.sql` The `rollback.sql` can be run to reverse the effect of `03-swap-global-blob-tables.sql`. diff --git a/services/notifications/Makefile b/services/notifications/Makefile index dd4fe38b8f..6a55407276 100644 --- a/services/notifications/Makefile +++ b/services/notifications/Makefile @@ -53,11 +53,10 @@ 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) node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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 $(IMAGE_CI) npm run --silent - -# Same but from the top of the monorepo -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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 -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -78,13 +77,13 @@ shellcheck_fix: done format: - $(RUN_LINTING) format + $(RUN_LINTING_MONOREPO) format -- services/notifications format_ci: - $(RUN_LINTING_CI) format + $(RUN_LINTING_CI_MONOREPO) format -- services/notifications format_fix: - $(RUN_LINTING) format:fix + $(RUN_LINTING_MONOREPO) format:fix -- services/notifications lint: $(RUN_LINTING) lint diff --git a/services/notifications/README.md b/services/notifications/README.md index da141ce352..d467fce6e1 100644 --- a/services/notifications/README.md +++ b/services/notifications/README.md @@ -1,20 +1,17 @@ -overleaf/notifications -=============== +# overleaf/notifications An API for managing user notifications in Overleaf - -database indexes -================ +# database indexes For notification expiry to work, a TTL index on `notifications.expires` must be created: ```javascript -db.notifications.createIndex({expires: 1}, {expireAfterSeconds: 10}) +db.notifications.createIndex({ expires: 1 }, { expireAfterSeconds: 10 }) ``` -License -======= +# License + The code in this repository is released under the GNU AFFERO GENERAL PUBLIC LICENSE, version 3. Copyright (c) Overleaf, 2016–2019. diff --git a/services/notifications/docker-compose.ci.yml b/services/notifications/docker-compose.ci.yml index 6e161ee381..f70c3645be 100644 --- a/services/notifications/docker-compose.ci.yml +++ b/services/notifications/docker-compose.ci.yml @@ -22,7 +22,6 @@ services: mongo: condition: service_started - test_acceptance: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -44,7 +43,6 @@ services: entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 -- command: npm run test:acceptance - tar: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -52,6 +50,7 @@ services: - ./:/tmp/build/ command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs . user: root + mongo: image: mongo:8.0.11 command: --replSet overleaf --notablescan diff --git a/services/notifications/docker-compose.yml b/services/notifications/docker-compose.yml index c0d301d9bb..f7195bce2a 100644 --- a/services/notifications/docker-compose.yml +++ b/services/notifications/docker-compose.yml @@ -64,4 +64,3 @@ services: # replica set. This override is not needed when running the setup after # starting up mongo. - mongo:127.0.0.1 - diff --git a/services/notifications/package.json b/services/notifications/package.json index c1720a394b..61e4f06775 100644 --- a/services/notifications/package.json +++ b/services/notifications/package.json @@ -11,8 +11,6 @@ "test:unit:_run": "vitest --config ./vitest.config.unit.cjs", "test:unit": "npm run test:unit:_run", "lint": "eslint --max-warnings 0 --format unix .", - "format": "prettier --list-different $PWD/'**/{*.*js,*.ts}'", - "format:fix": "prettier --write $PWD/'**/{*.*js,*.ts}'", "lint:fix": "eslint --fix .", "types:check": "tsc --noEmit", "nodemon": "node --watch app.ts" diff --git a/services/project-history/Makefile b/services/project-history/Makefile index cf786c260c..cd5d1acfb9 100644 --- a/services/project-history/Makefile +++ b/services/project-history/Makefile @@ -56,11 +56,10 @@ 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) node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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/document-updater/app/js/types.ts:/overleaf/services/document-updater/app/js/types.ts --volume $(MONOREPO)/services/project-history/reports:/overleaf/services/project-history/reports $(IMAGE_CI) npm run --silent - -# Same but from the top of the monorepo -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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/document-updater/app/js/types.ts:/overleaf/services/document-updater/app/js/types.ts --volume $(MONOREPO)/services/project-history/reports:/overleaf/services/project-history/reports -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -81,13 +80,13 @@ shellcheck_fix: done format: - $(RUN_LINTING) format + $(RUN_LINTING_MONOREPO) format -- services/project-history format_ci: - $(RUN_LINTING_CI) format + $(RUN_LINTING_CI_MONOREPO) format -- services/project-history format_fix: - $(RUN_LINTING) format:fix + $(RUN_LINTING_MONOREPO) format:fix -- services/project-history lint: $(RUN_LINTING) lint diff --git a/services/project-history/README.md b/services/project-history/README.md index 9d511926cd..322700b2b4 100644 --- a/services/project-history/README.md +++ b/services/project-history/README.md @@ -1,10 +1,8 @@ -@overleaf/project-history -========================== +# @overleaf/project-history An API for converting raw editor updates into a compressed and browseable history. -Running project-history ------------------------ +## Running project-history The app runs natively using npm and Node on the local system: @@ -13,8 +11,7 @@ npm install npm run start ``` -Unit Tests ----------- +## Unit Tests The test suites run in Docker. @@ -33,8 +30,7 @@ During development it is often useful to only run a subset of tests, which can b make test_unit MOCHA_ARGS='--grep=AuthorizationManager' ``` -Acceptance Tests ----------------- +## Acceptance Tests Acceptance tests are run against a live service, which runs in the `acceptance_test` container defined in `docker-compose.tests.yml`. @@ -61,8 +57,7 @@ During development it is often useful to only run a subset of tests, which can b make test_acceptance_run MOCHA_ARGS='--grep=AuthorizationManager' ``` -Makefile and npm scripts ------------------------- +## Makefile and npm scripts The commands used to compile the app and tests, to run the mocha tests, and to run the app are all in `package.json`. These commands call out to `coffee`, `mocha`, etc which are available to `npm` in the local `node_modules/.bin` directory, using the local versions. Normally, these commands should not be run directly, but instead run in docker via make. diff --git a/services/project-history/docker-compose.ci.yml b/services/project-history/docker-compose.ci.yml index 316a8cdbe3..52cf7e3c0a 100644 --- a/services/project-history/docker-compose.ci.yml +++ b/services/project-history/docker-compose.ci.yml @@ -27,7 +27,6 @@ services: redis_test: condition: service_healthy - test_acceptance: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -55,7 +54,6 @@ services: entrypoint: /overleaf/bin/shared/wait_for_it mongo:27017 --timeout=60 -- command: npm run test:acceptance - tar: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -63,6 +61,7 @@ services: - ./:/tmp/build/ command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs . user: root + redis_test: image: redis:7.4.3 healthcheck: diff --git a/services/project-history/docker-compose.yml b/services/project-history/docker-compose.yml index 8ae94744a9..05f0ba4d37 100644 --- a/services/project-history/docker-compose.yml +++ b/services/project-history/docker-compose.yml @@ -83,4 +83,3 @@ services: # replica set. This override is not needed when running the setup after # starting up mongo. - mongo:127.0.0.1 - diff --git a/services/project-history/package.json b/services/project-history/package.json index bed6861cee..81046a8e0a 100644 --- a/services/project-history/package.json +++ b/services/project-history/package.json @@ -12,8 +12,6 @@ "test:acceptance:_run": "mocha --loader=esmock --recursive --timeout 15000 --exit $@ test/acceptance/js", "test:unit:_run": "mocha --loader=esmock --recursive --exit $@ test/unit/js", "lint": "eslint --max-warnings 0 --format unix .", - "format": "prettier --list-different $PWD/'**/{*.*js,*.ts}'", - "format:fix": "prettier --write $PWD/'**/{*.*js,*.ts}'", "lint:fix": "eslint --fix .", "types:check": "tsc --noEmit" }, diff --git a/services/project-history/test/acceptance/fixtures/chunks/0-3.json b/services/project-history/test/acceptance/fixtures/chunks/0-3.json index 51441cf81d..6b74eaa811 100644 --- a/services/project-history/test/acceptance/fixtures/chunks/0-3.json +++ b/services/project-history/test/acceptance/fixtures/chunks/0-3.json @@ -21,17 +21,11 @@ "operations": [ { "pathname": "main.tex", - "textOperation": [ - 1912, - "Hello world", - 18726 - ] + "textOperation": [1912, "Hello world", 18726] } ], "timestamp": "2017-12-04T10:23:35.633Z", - "authors": [ - 31 - ] + "authors": [31] }, { "operations": [ @@ -41,24 +35,17 @@ } ], "timestamp": "2017-12-04T10:27:26.874Z", - "authors": [ - 31 - ] + "authors": [31] }, { "operations": [ { "pathname": "foo.tex", - "textOperation": [ - 26, - "\n\nFour five six" - ] + "textOperation": [26, "\n\nFour five six"] } ], "timestamp": "2017-12-04T10:28:33.724Z", - "authors": [ - 31 - ] + "authors": [31] } ] }, @@ -71,4 +58,4 @@ "name": "James" } ] -} \ No newline at end of file +} diff --git a/services/project-history/test/acceptance/fixtures/chunks/4-6.json b/services/project-history/test/acceptance/fixtures/chunks/4-6.json index 24040cfc4e..30075580d8 100644 --- a/services/project-history/test/acceptance/fixtures/chunks/4-6.json +++ b/services/project-history/test/acceptance/fixtures/chunks/4-6.json @@ -21,32 +21,21 @@ "operations": [ { "pathname": "foo.tex", - "textOperation": [ - 41, - "\n\nSeven eight nince" - ] + "textOperation": [41, "\n\nSeven eight nince"] } ], "timestamp": "2017-12-04T10:29:17.786Z", - "authors": [ - 31 - ] + "authors": [31] }, { "operations": [ { "pathname": "foo.tex", - "textOperation": [ - 58, - -1, - 1 - ] + "textOperation": [58, -1, 1] } ], "timestamp": "2017-12-04T10:29:22.905Z", - "authors": [ - 31 - ] + "authors": [31] }, { "operations": [ @@ -56,9 +45,7 @@ } ], "timestamp": "2017-12-04T10:29:26.120Z", - "authors": [ - 31 - ] + "authors": [31] } ] }, @@ -71,4 +58,4 @@ "name": "James" } ] -} \ No newline at end of file +} diff --git a/services/project-history/test/acceptance/fixtures/chunks/7-8.json b/services/project-history/test/acceptance/fixtures/chunks/7-8.json index 4325abc0df..e2ed4f1e0c 100644 --- a/services/project-history/test/acceptance/fixtures/chunks/7-8.json +++ b/services/project-history/test/acceptance/fixtures/chunks/7-8.json @@ -21,33 +21,21 @@ "operations": [ { "pathname": "main.tex", - "textOperation": [ - 1923, - " also updated", - 18726 - ] + "textOperation": [1923, " also updated", 18726] } ], "timestamp": "2017-12-04T10:32:47.277Z", - "authors": [ - 31 - ] + "authors": [31] }, { "operations": [ { "pathname": "bar.tex", - "textOperation": [ - 28, - -15, - 16 - ] + "textOperation": [28, -15, 16] } ], "timestamp": "2017-12-04T10:32:52.877Z", - "v2Authors": [ - "5a5637efdac84e81b71014c4" - ] + "v2Authors": ["5a5637efdac84e81b71014c4"] } ] }, @@ -60,4 +48,4 @@ "name": "James" } ] -} \ No newline at end of file +} diff --git a/services/real-time/Makefile b/services/real-time/Makefile index 6e4565e428..c2331749dd 100644 --- a/services/real-time/Makefile +++ b/services/real-time/Makefile @@ -51,11 +51,10 @@ 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) node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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/real-time/reports:/overleaf/services/real-time/reports $(IMAGE_CI) npm run --silent - -# Same but from the top of the monorepo -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 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/real-time/reports:/overleaf/services/real-time/reports -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -76,13 +75,13 @@ shellcheck_fix: done format: - $(RUN_LINTING) format + $(RUN_LINTING_MONOREPO) format -- services/real-time format_ci: - $(RUN_LINTING_CI) format + $(RUN_LINTING_CI_MONOREPO) format -- services/real-time format_fix: - $(RUN_LINTING) format:fix + $(RUN_LINTING_MONOREPO) format:fix -- services/real-time lint: $(RUN_LINTING) lint diff --git a/services/real-time/docker-compose.ci.yml b/services/real-time/docker-compose.ci.yml index ea19322016..9ed86aa1d6 100644 --- a/services/real-time/docker-compose.ci.yml +++ b/services/real-time/docker-compose.ci.yml @@ -25,7 +25,6 @@ services: redis_test: condition: service_healthy - test_acceptance: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -49,7 +48,6 @@ services: user: node command: npm run test:acceptance - tar: build: . image: ci/$PROJECT_NAME:$BRANCH_NAME-$BUILD_NUMBER @@ -57,10 +55,10 @@ services: - ./:/tmp/build/ command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs . user: root + redis_test: image: redis:7.4.3 healthcheck: test: ping="$$(redis-cli ping)" && [ "$$ping" = 'PONG' ] interval: 1s retries: 20 - diff --git a/services/real-time/docker-compose.yml b/services/real-time/docker-compose.yml index 0c542a1005..b38654bca1 100644 --- a/services/real-time/docker-compose.yml +++ b/services/real-time/docker-compose.yml @@ -59,4 +59,3 @@ services: test: ping=$$(redis-cli ping) && [ "$$ping" = 'PONG' ] interval: 1s retries: 20 - diff --git a/services/real-time/package.json b/services/real-time/package.json index d89f49f4b9..cf3daf942d 100644 --- a/services/real-time/package.json +++ b/services/real-time/package.json @@ -12,8 +12,6 @@ "test:unit": "npm run test:unit:_run", "nodemon": "node --watch app.js", "lint": "eslint --max-warnings 0 --format unix .", - "format": "prettier --list-different $PWD/'**/{*.*js,*.ts}'", - "format:fix": "prettier --write $PWD/'**/{*.*js,*.ts}'", "lint:fix": "eslint --fix .", "types:check": "tsc --noEmit" }, diff --git a/services/web/.prettierignore b/services/web/.prettierignore deleted file mode 100644 index d734fec0f9..0000000000 --- a/services/web/.prettierignore +++ /dev/null @@ -1,40 +0,0 @@ -# NOTE: changing paths may require updating them in the Makefile too. -data/ -scripts/translations/.cache/ -node_modules -frontend/js/vendor -modules/**/frontend/js/vendor -public/js -public/minjs -frontend/stylesheets/modules/metrics/nvd3.scss -frontend/js/features/source-editor/lezer-latex/latex.mjs -frontend/js/features/source-editor/lezer-latex/latex.terms.mjs -frontend/js/features/source-editor/lezer-bibtex/bibtex.mjs -frontend/js/features/source-editor/lezer-bibtex/bibtex.terms.mjs -frontend/js/features/source-editor/hunspell/wasm/hunspell.mjs - -# complex pages -app/views/project/editor.pug -app/views/project/editor/** -modules/open-in-overleaf/app/views/documentation.pug -modules/references-search/app/views/project/editor/** -modules/rich-text/app/views/toolbar.pug - -# loops -app/views/referal/bonus.pug -modules/templates/app/views/tag.pug - -# expressions that could not be formatted correctly -app/views/_mixins/faq_search.pug -app/views/external/home/v2.pug -app/views/project/token/access.pug -app/views/user/primaryEmailCheck.pug -app/views/user/restricted.pug -modules/admin-panel/app/views/project/show.pug -modules/templates/app/views/project/editor/_left-menu.pug -modules/two-factor-authentication/app/views/_mixins.pug - -# minified files -app/views/_google_analytics.pug -app/views/_customer_io.pug -frontend/js/shared/lottie/** diff --git a/services/web/.prettierrc b/services/web/.prettierrc deleted file mode 100644 index 20f2d1d2ff..0000000000 --- a/services/web/.prettierrc +++ /dev/null @@ -1,23 +0,0 @@ -{ - "arrowParens": "avoid", - "jsxSingleQuote": false, - "pugAttributeSeparator": "as-needed", - "pugBracketSpacing": false, - "pugClassNotation": "as-is", - "pugIdNotation": "as-is", - "pugSortAttributesBeginning": ["name", "data-type"], - "plugins": ["@prettier/plugin-pug", "prettier-plugin-groovy"], - "semi": false, - "singleQuote": true, - "trailingComma": "es5", - "tabWidth": 2, - "useTabs": false, - "overrides": [ - { - "files": "*.pug", - "options": { - "useTabs": true - } - } - ] -} diff --git a/services/web/Makefile b/services/web/Makefile index d3ffa8f92c..58d8285c0b 100644 --- a/services/web/Makefile +++ b/services/web/Makefile @@ -431,9 +431,16 @@ ci: # # Lint & format # + +# Run the linting commands in the scope of the monorepo. +# Eslint and prettier (plus some configs) are on the root. +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) {{node_image}}:{{node_version}} 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/web/data/reports:/overleaf/services/web/data/reports -w /overleaf $(IMAGE_CI) npm run --silent + ORG_PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUN_LINT_FORMAT ?= \ - docker run --rm --env BRANCH_NAME --env CI --env COMMIT_SHA --env MONOREPO --volume ${PWD}/data/reports:/overleaf/services/web/data/reports ${IMAGE_CI} + docker run --rm --env BRANCH_NAME --env CI --env COMMIT_SHA --env MONOREPO --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume ${PWD}/data/reports:/overleaf/services/web/data/reports ${IMAGE_CI} NODE_MODULES_PATH := ${PATH}:${PWD}/node_modules/.bin:/overleaf/services/web/node_modules/.bin WITH_NODE_MODULES_PATH = \ @@ -505,34 +512,34 @@ lint_in_docker: format: format_js format_js: - npm run --silent format + $(RUN_LINTING_MONOREPO) format -- services/web -format: format_styles -format_styles: - npm run --silent format:styles - -format: format_pug -format_pug: - npm run --silent format:pug - -format: format_jenkins -format_jenkins: - npm run --silent format:jenkins +format_ci: + $(RUN_LINTING_CI_MONOREPO) format -- services/web format_fix: - npm run --silent format:fix + $(RUN_LINTING_MONOREPO) format:fix -- services/web + +format_styles: + $(RUN_LINTING_MONOREPO) format:styles format_styles_fix: - npm run --silent format:styles:fix + $(RUN_LINTING_MONOREPO) format:styles:fix + +format_pug: + $(RUN_LINTING_MONOREPO) format:pug format_pug_fix: - npm run --silent format:pug:fix + $(RUN_LINTING_MONOREPO) format:pug:fix + +format_jenkins: + $(RUN_LINTING_MONOREPO) format:jenkins format_jenkins_fix: - npm run --silent format:jenkins:fix + $(RUN_LINTING_MONOREPO) format:jenkins:fix format_in_docker: - $(RUN_LINT_FORMAT) make format -j2 --output-sync + $(RUN_LINT_FORMAT) npm run --prefix /overleaf format -- services/web SHELLCHECK_OPTS = \ --shell=bash \ diff --git a/services/web/README.md b/services/web/README.md index f82a55d6f2..04db7274d9 100644 --- a/services/web/README.md +++ b/services/web/README.md @@ -1,12 +1,10 @@ -overleaf/web -============== +# overleaf/web overleaf/web is the front-end web service of the open-source web-based collaborative LaTeX editor, [Overleaf](https://www.overleaf.com). It serves all the HTML pages, CSS and javascript to the client. overleaf/web also contains a lot of logic around creating and editing projects, and account management. - The rest of the Overleaf stack, along with information about contributing can be found in the [overleaf/overleaf](https://github.com/overleaf/overleaf) repository. @@ -22,11 +20,13 @@ $ npm run start ### Running Tests To run all tests run: + ``` make test ``` To run both unit and acceptance tests for a module run: + ``` make test_module MODULE=saas-authentication ``` @@ -50,11 +50,13 @@ make test_unit MOCHA_GREP='AuthorizationManager' ``` To run only the unit tests for a single module do: + ``` make test_unit_module MODULE=saas-authentication ``` Module tests can also use a MOCHA_GREP argument: + ``` make test_unit_module MODULE=saas-authentication MOCHA_GREP=SSO ``` @@ -86,23 +88,22 @@ make test_acceptance_run MOCHA_GREP='AuthorizationManager' ``` To run only the acceptance tests for a single module do: + ``` make test_acceptance_module MODULE=saas-authentication ``` Module tests can also use a MOCHA_GREP argument: + ``` make test_acceptance_module MODULE=saas-authentication MOCHA_GREP=SSO ``` -Routes ------- +## Routes Run `bin/routes` to print out all routes in the project. - -License and Credits -------------------- +## License and Credits This project is licensed under the [AGPLv3 license](http://www.gnu.org/licenses/agpl-3.0.html) @@ -127,4 +128,3 @@ of these icons are used within Overleaf inside the `public/img/silk` and We gratefully acknowledge [IconShock](http://www.iconshock.com) for use of the icons in the `public/img/iconshock` directory found via [findicons.com](http://findicons.com/icon/498089/height?id=526085#) - diff --git a/services/web/cypress/support/component-index.html b/services/web/cypress/support/component-index.html index ac6e79fd83..faf3b5f43b 100644 --- a/services/web/cypress/support/component-index.html +++ b/services/web/cypress/support/component-index.html @@ -1,12 +1,12 @@ - + - - - + + + Components App
- \ No newline at end of file + diff --git a/services/web/docker-compose.ci.yml b/services/web/docker-compose.ci.yml index f287cd8bd5..75c775e28d 100644 --- a/services/web/docker-compose.ci.yml +++ b/services/web/docker-compose.ci.yml @@ -2,7 +2,6 @@ volumes: data: services: - test_unit: build: context: ../.. @@ -49,7 +48,7 @@ services: OVERLEAF_CONFIG: REDIS_HOST: redis_test extra_hosts: - - 'www.overleaf.test:127.0.0.1' + - "www.overleaf.test:127.0.0.1" volumes: - ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it - ./data/reports:/overleaf/services/web/data/reports @@ -151,15 +150,15 @@ services: # REF: https://github.com/moby/moby/issues/8231#issuecomment-63877553 # REF: https://github.com/moby/moby/issues/8231#issuecomment-63871343 command: - - 'bash' - - '-c' - - 'ulimit -n 1024 && exec bash /run.sh' + - "bash" + - "-c" + - "ulimit -n 1024 && exec bash /run.sh" saml: - image: us-east1-docker.pkg.dev/overleaf-ops/ol-docker/saml-test - logging: - driver: none - environment: - SAML_BASE_URL_PATH: 'http://saml/simplesaml/' - SAML_TEST_SP_ENTITY_ID: 'overleaf-test-saml' - SAML_TEST_SP_LOCATION: 'http://www.overleaf.test:23000/saml/callback' + image: us-east1-docker.pkg.dev/overleaf-ops/ol-docker/saml-test + logging: + driver: none + environment: + SAML_BASE_URL_PATH: "http://saml/simplesaml/" + SAML_TEST_SP_ENTITY_ID: "overleaf-test-saml" + SAML_TEST_SP_LOCATION: "http://www.overleaf.test:23000/saml/callback" diff --git a/services/web/docker-compose.yml b/services/web/docker-compose.yml index 47cbb4056e..aabb276e9b 100644 --- a/services/web/docker-compose.yml +++ b/services/web/docker-compose.yml @@ -2,7 +2,6 @@ volumes: data: services: - test_unit: image: node:24.13.0 volumes: @@ -56,7 +55,7 @@ services: # OVERLEAF_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING: 'true' extra_hosts: - - 'www.overleaf.test:127.0.0.1' + - "www.overleaf.test:127.0.0.1" depends_on: - redis_test - mongo @@ -143,13 +142,13 @@ services: # REF: https://github.com/moby/moby/issues/8231#issuecomment-63877553 # REF: https://github.com/moby/moby/issues/8231#issuecomment-63871343 command: - - 'bash' - - '-c' - - 'ulimit -n 1024 && exec bash /run.sh' + - "bash" + - "-c" + - "ulimit -n 1024 && exec bash /run.sh" saml: - image: us-east1-docker.pkg.dev/overleaf-ops/ol-docker/saml-test - environment: - SAML_BASE_URL_PATH: 'http://saml/simplesaml/' - SAML_TEST_SP_ENTITY_ID: 'overleaf-test-saml' - SAML_TEST_SP_LOCATION: 'http://www.overleaf.test:23000/saml/callback' + image: us-east1-docker.pkg.dev/overleaf-ops/ol-docker/saml-test + environment: + SAML_BASE_URL_PATH: "http://saml/simplesaml/" + SAML_TEST_SP_ENTITY_ID: "overleaf-test-saml" + SAML_TEST_SP_LOCATION: "http://www.overleaf.test:23000/saml/callback" diff --git a/services/web/frontend/fonts/README.md b/services/web/frontend/fonts/README.md index 3016634b1a..d962c0a668 100644 --- a/services/web/frontend/fonts/README.md +++ b/services/web/frontend/fonts/README.md @@ -1,14 +1,14 @@ This directory contains fonts used by the Overleaf web application. -* [DM Mono](https://github.com/googlefonts/dm-mono) -* [Font Awesome](https://fontawesome.com/v4/) -* [Inter](https://rsms.me/inter/) -* [Lato](https://www.latofonts.com/) -* [Material Symbols](https://github.com/google/material-design-icons) -* [Merriweather](https://github.com/SorkinType/Merriweather) -* [Noto Sans](https://notofonts.github.io/#latin-greek-cyrillic) -* [Noto Serif](https://notofonts.github.io/#latin-greek-cyrillic) -* [OpenDyslexic Mono](https://github.com/antijingoist/opendyslexic/tree/master) -* [Open Sans](https://github.com/googlefonts/opensans) -* [Source Code Pro](https://github.com/adobe-fonts/source-code-pro) -* [STIX Two Math](https://github.com/stipub/stixfonts/) +- [DM Mono](https://github.com/googlefonts/dm-mono) +- [Font Awesome](https://fontawesome.com/v4/) +- [Inter](https://rsms.me/inter/) +- [Lato](https://www.latofonts.com/) +- [Material Symbols](https://github.com/google/material-design-icons) +- [Merriweather](https://github.com/SorkinType/Merriweather) +- [Noto Sans](https://notofonts.github.io/#latin-greek-cyrillic) +- [Noto Serif](https://notofonts.github.io/#latin-greek-cyrillic) +- [OpenDyslexic Mono](https://github.com/antijingoist/opendyslexic/tree/master) +- [Open Sans](https://github.com/googlefonts/opensans) +- [Source Code Pro](https://github.com/adobe-fonts/source-code-pro) +- [STIX Two Math](https://github.com/stipub/stixfonts/) diff --git a/services/web/frontend/js/features/settings/data/countries-list.ts b/services/web/frontend/js/features/settings/data/countries-list.ts index 976c13227e..4952c205e7 100644 --- a/services/web/frontend/js/features/settings/data/countries-list.ts +++ b/services/web/frontend/js/features/settings/data/countries-list.ts @@ -253,4 +253,4 @@ const countries = [ ] export default countries -export type CountryCode = typeof countries[number]['code'] +export type CountryCode = (typeof countries)[number]['code'] diff --git a/services/web/frontend/js/features/source-editor/hunspell/wasm/README.md b/services/web/frontend/js/features/source-editor/hunspell/wasm/README.md index 81dd64da36..7d95966b75 100644 --- a/services/web/frontend/js/features/source-editor/hunspell/wasm/README.md +++ b/services/web/frontend/js/features/source-editor/hunspell/wasm/README.md @@ -2,8 +2,8 @@ The files in this directory are: -* `hunspell.wasm`: [Hunspell](https://github.com/hunspell/hunspell) compiled to WebAssembly using Emscripten, via the [build.sh](../build.sh) script. -* `hunspell.mjs`: a JavaScript wrapper for the WebAssembly module, generated by Emscripten. -* `hunspell.d.ts`: manually-created types for the exports from the JavaScript module. +- `hunspell.wasm`: [Hunspell](https://github.com/hunspell/hunspell) compiled to WebAssembly using Emscripten, via the [build.sh](../build.sh) script. +- `hunspell.mjs`: a JavaScript wrapper for the WebAssembly module, generated by Emscripten. +- `hunspell.d.ts`: manually-created types for the exports from the JavaScript module. Note: To speed up compilation on ARM architecture (e.g. Apple M1), add `-arm64` to the Docker image tag in `Dockerfile`. diff --git a/services/web/frontend/js/features/source-editor/lezer-latex/README.md b/services/web/frontend/js/features/source-editor/lezer-latex/README.md index 2da27c3b61..692c0f06b8 100644 --- a/services/web/frontend/js/features/source-editor/lezer-latex/README.md +++ b/services/web/frontend/js/features/source-editor/lezer-latex/README.md @@ -4,7 +4,6 @@ Lezer-LaTeX is a LaTeX parser implemented with [lezer](https://lezer.codemirror. The parser is written in a "grammar" file, (and a "tokens" file with custom tokenizer logic) which is then compiled by `@lezer/generator` into a parser module and a "terms" module. The parser module is then loaded by the CodeMirror 6 in the web frontend codebase. - ## Important files - Source files: @@ -23,7 +22,6 @@ The parser is written in a "grammar" file, (and a "tokens" file with custom toke - Webpack plugins: - `web/webpack-plugins/lezer-grammar-compiler.js`: A webpack plugin that calls the generator as part of the webpack build. In dev, it will automatically re-build the parser when the grammar file changes. - ## NPM tasks - `lezer-latex:generate`: Generate the parser files from the grammar @@ -33,7 +31,6 @@ The parser is written in a "grammar" file, (and a "tokens" file with custom toke - `lezer-latex:run`: Run the parser against a file - (Calls `lezer-latex/run.js`) - ### Generating the parser From the monorepo root: @@ -46,7 +43,6 @@ make install bin/npm -w services/web run 'lezer-latex:generate' ``` - ## Tests Unit tests for the parser live in `web/test/unit/src/LezerLatex`. There are three kinds of test, in three subdirectories: @@ -57,11 +53,10 @@ Unit tests for the parser live in `web/test/unit/src/LezerLatex`. There are thre These tests run as part of `test_frontend`. You can run these tests alone by invoking: -``` sh +```sh make test_unit MOCHA_GREP='lezer-latex' ``` - ## Trying the parser While developing the parser, you can run it against a file by calling the `lezer-latex:run` task. There are @@ -69,13 +64,12 @@ some example files in the test suite, at `web/test/unit/src/LezerLatex/examples/ For example: -``` sh +```sh bin/npm -w services/web run 'lezer-latex:run' web/test/unit/src/LezerLatex/examples/amsmath.tex ``` If you omit the file path, the default file (`examples/demo.tex`) will be run. - ## Integration into web The web frontend imports the parser (from `latex.mjs`), in `frontend/js/features/source-editor/languages/latex/index.ts`. diff --git a/services/web/frontend/js/features/subscription/data/add-on-codes.ts b/services/web/frontend/js/features/subscription/data/add-on-codes.ts index 4ee7a65b22..d639340ab3 100644 --- a/services/web/frontend/js/features/subscription/data/add-on-codes.ts +++ b/services/web/frontend/js/features/subscription/data/add-on-codes.ts @@ -1,20 +1,20 @@ -import { PaidSubscription } from "../../../../../types/subscription/dashboard/subscription" -import { PendingPaymentProviderPlan } from "../../../../../types/subscription/plan" +import { PaidSubscription } from '../../../../../types/subscription/dashboard/subscription' +import { PendingPaymentProviderPlan } from '../../../../../types/subscription/plan' export const AI_ASSIST_STANDALONE_MONTHLY_PLAN_CODE = 'assistant' export const AI_ADD_ON_CODE = 'assistant' // we dont want translations on plan or add-on names -export const ADD_ON_NAME = "AI Assist" +export const ADD_ON_NAME = 'AI Assist' export const AI_ASSIST_STANDALONE_ANNUAL_PLAN_CODE = 'assistant-annual' export function isStandaloneAiPlanCode(planCode?: string) { - return planCode === AI_ASSIST_STANDALONE_MONTHLY_PLAN_CODE || planCode === AI_ASSIST_STANDALONE_ANNUAL_PLAN_CODE + return ( + planCode === AI_ASSIST_STANDALONE_MONTHLY_PLAN_CODE || + planCode === AI_ASSIST_STANDALONE_ANNUAL_PLAN_CODE + ) } - - -export function hasPendingAiAddonCancellation(subscription: PaidSubscription){ - +export function hasPendingAiAddonCancellation(subscription: PaidSubscription) { const pendingPlan = subscription.pendingPlan as PendingPaymentProviderPlan const hasAiAddon = subscription.addOns?.some( @@ -22,11 +22,12 @@ export function hasPendingAiAddonCancellation(subscription: PaidSubscription){ ) // cancellation of entire plan counts as removing the add-on - if(hasAiAddon && !pendingPlan){ + if (hasAiAddon && !pendingPlan) { return true } - return hasAiAddon && + return ( + hasAiAddon && !pendingPlan.addOns?.some(addOn => addOn.code === AI_ADD_ON_CODE) - -} \ No newline at end of file + ) +} diff --git a/services/web/frontend/stories/docs/cloud-builds.mdx b/services/web/frontend/stories/docs/cloud-builds.mdx index 815240d8a4..3534068ae6 100644 --- a/services/web/frontend/stories/docs/cloud-builds.mdx +++ b/services/web/frontend/stories/docs/cloud-builds.mdx @@ -1,8 +1,7 @@ -import { Meta } from '@storybook/blocks'; +import { Meta } from '@storybook/blocks' - # Cloud Builds Storybook builds can be used to share your development work. They can be found at [https://storybook.dev-overleaf.com/](https://storybook.dev-overleaf.com/). diff --git a/services/web/frontend/stories/docs/feature-flags.mdx b/services/web/frontend/stories/docs/feature-flags.mdx index c34b4d422f..56fdd7e121 100644 --- a/services/web/frontend/stories/docs/feature-flags.mdx +++ b/services/web/frontend/stories/docs/feature-flags.mdx @@ -1,4 +1,4 @@ -import { Canvas, Controls, Meta } from '@storybook/blocks'; +import { Canvas, Controls, Meta } from '@storybook/blocks' import * as FormatCurrency from './format-currency.stories' @@ -8,7 +8,7 @@ import * as FormatCurrency from './format-currency.stories' You can wrap your story with the `withSplitTests` utility to add split test variants to your Storybook stories, so you can toggle feature flags directly in the Storybook UI. See [withSplitTests on GitHub](https://github.com/overleaf/internal/blob/main/services/web/.storybook/utils/with-split-tests.tsx). 1. Define your split test argTypes: -Add your split test configurations to the `splitTestsArgTypes` object. + Add your split test configurations to the `splitTestsArgTypes` object. ```js export const splitTestsArgTypes = { @@ -19,6 +19,7 @@ export const splitTestsArgTypes = { }, } ``` + 2. Wrap your story with `withSplitTests`. Import `withSplitTests` and `Meta` from '@storybook/react' in your stories. diff --git a/services/web/frontend/stories/docs/foundations.mdx b/services/web/frontend/stories/docs/foundations.mdx index 2e41a44003..d5a972fef3 100644 --- a/services/web/frontend/stories/docs/foundations.mdx +++ b/services/web/frontend/stories/docs/foundations.mdx @@ -1,19 +1,35 @@ -import { Meta, ColorItem, ColorPalette, Title, Typeset } from '@storybook/blocks'; -import colors from '../../stylesheets/foundations/tokens/colors.json'; -import typography from '../../stylesheets/foundations/tokens/typography.json'; -import borderRadius from '../../stylesheets/foundations/tokens/borderRadius.json'; -import spacing from '../../stylesheets/foundations/tokens/spacing.json'; +import { + Meta, + ColorItem, + ColorPalette, + Title, + Typeset, +} from '@storybook/blocks' +import colors from '../../stylesheets/foundations/tokens/colors.json' +import typography from '../../stylesheets/foundations/tokens/typography.json' +import borderRadius from '../../stylesheets/foundations/tokens/borderRadius.json' +import spacing from '../../stylesheets/foundations/tokens/spacing.json' # Foundations Foundations in UX design are the basic rules and core elements, like colors, fonts, and spacing, that ensure consistency across the design. +

- These palettes are generated from our token files. The tokens were exported from Figma and split into separate files to categorise: Token files on GitHub + These palettes are generated from our token files. The tokens were exported + from Figma and split into separate files to categorise:{' '} + + Token files on GitHub +

**Table of Contents** + - [Primitive colors](#primitive-colors) - [Background colors](#background-colors) - [Content colors](#content-colors) @@ -26,17 +42,14 @@ Foundations in UX design are the basic rules and core elements, like colors, fon - [Spacing](#spacing) # Colors -
+ +
## Primitive colors {Object.entries(colors.PrimitiveColor).map(([name, color]) => ( - + ))} @@ -126,12 +139,15 @@ Colors used for specific UI elements like color pickers. # Typography -
+ +
## Font weight -
+ +
{Object.entries(typography.Fontweight).map(([name, typography]) => ( +
{name} + +
{Object.entries(typography['Fontsize']).map(([name, typography]) => { - const mixins = typography.$mixin ? [].concat(typography.$mixin) : []; +const mixins = typography.$mixin ? [].concat(typography.$mixin) : []; - return ( -
- - {name} - {mixins.map(mixin => ( - / @mixin {mixin} - ))} - - -
- ); +return ( + +
+ +{name} +{mixins.map(mixin => ( + / @mixin {mixin} +))} + + +
+); })} ## Border radius -
+ +
@@ -177,30 +196,33 @@ Colors used for specific UI elements like color pickers. - {Object.entries(borderRadius['BorderRadius']).map(([name, borderRadius]) => ( - - - - - - ))} + {Object.entries(borderRadius['BorderRadius']).map( + ([name, borderRadius]) => ( + + + + + + ) + )}
- {name} - {borderRadius.$value}px -
-
+ {name} + {borderRadius.$value}px +
+
## Spacing -
+ +
diff --git a/services/web/locales/README.md b/services/web/locales/README.md index 343f4a533e..a58660ae03 100644 --- a/services/web/locales/README.md +++ b/services/web/locales/README.md @@ -1,5 +1,4 @@ -Locales -======= +# Locales These files are not to be edited by hand. diff --git a/services/web/package.json b/services/web/package.json index d7af8e9799..aa711864a8 100644 --- a/services/web/package.json +++ b/services/web/package.json @@ -25,14 +25,6 @@ "webpack": "webpack serve --config webpack.config.dev.js", "webpack:production": "webpack --config webpack.config.prod.js", "webpack:profile": "webpack --config webpack.config.prod.js --profile --json > stats.json", - "format": "prettier --list-different $PWD/'**/*.{js,jsx,mjs,ts,tsx,json}'", - "format:fix": "prettier --write $PWD/'**/*.{js,jsx,mjs,ts,tsx,json}'", - "format:styles": "prettier --list-different $PWD/'**/*.{css,scss}'", - "format:styles:fix": "prettier --write $PWD/'**/*.{css,scss}'", - "format:pug": "prettier --list-different $PWD/'**/*.pug'", - "format:pug:fix": "prettier --write $PWD/'**/*.pug'", - "format:jenkins": "prettier --list-different $PWD/'**/Jenkinsfile'", - "format:jenkins:fix": "prettier --write $PWD/'**/Jenkinsfile'", "lint": "eslint --max-warnings 0 --format unix --ext .js,.jsx,.mjs,.ts,.tsx .", "lint:fix": "eslint --fix --ext .js,.jsx,.mjs,.ts,.tsx .", "lint:styles": "stylelint '**/*.scss'", @@ -200,6 +192,7 @@ "zod-validation-error": "^4.0.1" }, "devDependencies": { + "5to6-codemod": "^1.8.0", "@ai-sdk/react": "^3.0.2", "@babel/core": "^7.28.5", "@babel/plugin-proposal-decorators": "^7.28.0", @@ -231,7 +224,6 @@ "@pollyjs/adapter-node-http": "^6.0.6", "@pollyjs/core": "^6.0.6", "@pollyjs/persister-fs": "^6.0.6", - "@prettier/plugin-pug": "^3.4.0", "@replit/codemirror-emacs": "overleaf/codemirror-emacs#4394c03858f27053f8768258e9493866e06e938e", "@replit/codemirror-indentation-markers": "overleaf/codemirror-indentation-markers#371ce3b56f453a392eb0d3b85ab019c185c68e1f", "@replit/codemirror-vim": "overleaf/codemirror-vim#1bef138382d948018f3f9b8a4d7a70ab61774e4b", @@ -285,7 +277,6 @@ "@writefull/core": "^1.27.27", "@writefull/ui": "^1.27.27", "@writefull/utils": "^1.27.27", - "5to6-codemod": "^1.8.0", "abort-controller": "^3.0.0", "acorn": "^7.1.1", "acorn-walk": "^7.1.1", diff --git a/services/web/scripts/delete-orphaned-docs/README.md b/services/web/scripts/delete-orphaned-docs/README.md index 01582990e3..4ab72be67f 100644 --- a/services/web/scripts/delete-orphaned-docs/README.md +++ b/services/web/scripts/delete-orphaned-docs/README.md @@ -12,15 +12,19 @@ and copying the files to your local machine. Run the following doc export command to export all doc ids and their associated project ids in batches of 10,000,000. + ``` mongoexport --uri $READ_ONLY_MONGO_CONNECTION_STRING --collection docs --fields '_id,project_id' --skip 0 --limit 10000000 --type=csv --out docs.00000000.csv ``` + This will produce files like: + ``` _id,project_id ObjectId(5babb6f864c952737a9a4c32),ObjectId(5b98bba5e2f38b7c88f6a625) ObjectId(4eecaffcbffa66588e000007),ObjectId(4eecaffcbffa66588e00000d) ``` + Concatenate these into a single file: `cat docs.*csv > all-docs-doc_id-project_id.csv` For object ids the script will accept either plain hex strings or the `ObjectId(...)` @@ -29,35 +33,42 @@ format used by mongoexport. ### Exporting Projects Export project ids from all `projects` and `deletedProjects` + ``` mongoexport --uri $READ_ONLY_MONGO_CONNECTION_STRING --collection projects --fields '_id' --type=csv --out projects.csv mongoexport --uri $READ_ONLY_MONGO_CONNECTION_STRING --collection deletedProjects --fields 'project._id' --type=csv --out deleted-projects.csv ``` + Concatenate these: `cat projects.csv deleted-projects.csv > all-projects-project_id.csv` ## Processing Exported Data ### Create a unique sorted list of project ids from docs + ``` cut -d, -f 2 all-docs-doc_id-project_id.csv | sort | uniq > all-docs-project_ids.sorted.uniq.csv ``` ### Create a unique sorted list of projects ids from projects + ``` sort all-projects-project_id.csv | uniq > all-projects-project_id.sorted.uniq.csv ``` ### Create list of project ids in docs but not in projects + ``` comm --check-order -23 all-docs-project_ids.sorted.uniq.csv all-projects-project_id.sorted.uniq.csv > orphaned-doc-project_ids.csv ``` ### Create list of docs ids with project ids not in projects + ``` grep -F -f orphaned-doc-project_ids.csv all-docs-doc_id-project_id.csv > orphaned-doc-doc_id-project_id.csv ``` ## Run doc deleter + ``` node delete-orphaned-docs orphaned-doc-doc_id-project_id.csv ``` diff --git a/services/web/scripts/learn/checkSanitize/README.md b/services/web/scripts/learn/checkSanitize/README.md index 27c903d96f..dd8e8f80d3 100644 --- a/services/web/scripts/learn/checkSanitize/README.md +++ b/services/web/scripts/learn/checkSanitize/README.md @@ -7,10 +7,10 @@ node scripts/learn/checkSanitize/index.mjs https://LEARN_WIKI ## Bulk export There is a bulk export for media wiki pages, but it produces different - html escaping compared to the regular parse API we use in web. +html escaping compared to the regular parse API we use in web. The bulk export does not escape all the placeholder HTML-like elements, - like ``. +like ``. ## Example output diff --git a/services/web/scripts/sync-user-entitlements/README.md b/services/web/scripts/sync-user-entitlements/README.md index b89b40e14f..f7574305a6 100644 --- a/services/web/scripts/sync-user-entitlements/README.md +++ b/services/web/scripts/sync-user-entitlements/README.md @@ -14,6 +14,7 @@ Follow the directions in `google-ops/README.md` for exporting data from mongo and copying the files to your local machine. Run the following user export command. + ``` mongoexport --uri $READ_ONLY_MONGO_CONNECTION_STRING --collection users --fields '_id,email,emails,samlIdentifiers' --query '{"samlIdentifiers.providerId": {"$exists": 1}}' --out user-entitlements.json ``` @@ -26,6 +27,7 @@ is never transferred or stored insecurely and that it is deleted ASAP** Connect to postgres by running `heroku psql -a electric-leaf-4093` Run the following v2_user_universities export comand. + ``` \copy (select uu.user_id, uu.email, uu.cached_entitlement, ud.university_id from v2_user_universities uu LEFT JOIN university_domains ud ON uu.university_domain_id = ud.id WHERE uu.removed_at IS NULL) to 'cached-entitlements.csv' with csv; ``` diff --git a/services/web/test/smoke/src/README.md b/services/web/test/smoke/src/README.md index ac8d9e28a4..c9b918462b 100644 --- a/services/web/test/smoke/src/README.md +++ b/services/web/test/smoke/src/README.md @@ -1,12 +1,12 @@ # SmokeTests For the SmokeTests we implemented a Mini-Framework that is tailored for our - tooling, specifically OError, and does not need a large runner, such as mocha. +tooling, specifically OError, and does not need a large runner, such as mocha. The SmokeTests are separated into individual `steps`. Each `step` can have a `run` function and a `cleanup` function. The former will run in sequence with the other steps, the later in reverse - order from the finish, or the last failure. +order from the finish, or the last failure. ```js async function run(ctx) { @@ -19,21 +19,22 @@ module.exports = { cleanup, run } ``` Steps will get called with a context object with common helpers and details: + - `request` a promisified `request` module with defaults for `baseUrl`, - `timeout` and internals for cookie handling. + `timeout` and internals for cookie handling. - `assertHasStatusCode` a helper for asserting response status codes, pass - a response and desired status code. It will throw with OError context set. + a response and desired status code. It will throw with OError context set. - `getCsrfTokenFor` a helper for retrieving CSRF tokens, pass an endpoint. - `processWithTimeout` a helper for awaiting Promises with a timeout, pass - `{ work: Promise.resolve(), timeout: 42, message: 'foo timedout' }` + `{ work: Promise.resolve(), timeout: 42, message: 'foo timedout' }` - `stats` an object for performance tracking. - `timeout` the step timeout Steps should handle timeouts locally to ensure appropriate cleanup of timed out - actions. +actions. Steps may pass values along to the next steps in returning an object with the - desired fields from the `run` or `cleanup` function. +desired fields from the `run` or `cleanup` function. The returned values will overwrite existing details in the `ctx`. Alpha-numeric sorting of step filenames determines the processing sequence. diff --git a/tools/migrations/README.md b/tools/migrations/README.md index 13a0865077..77cf816a76 100644 --- a/tools/migrations/README.md +++ b/tools/migrations/README.md @@ -12,6 +12,7 @@ npm run migrations -- list -t 'server-ce' ``` For SAAS, use the rake tasks for staging/production + ```shell rake deploy:migrations:list[staging] ``` @@ -30,7 +31,6 @@ For example, a migration that should run in every environment would be tagged wi When invoking east, we specify the relevant tags with the `-t` or `--tags` flag. Our adapter will refuse to run if this flag is not set. - ### Creating new migrations To create a new migration, run: @@ -52,12 +52,14 @@ through the migrations' mechanism. ### Running migrations To run all migrations in a server-ce environment: + ```shell npm run migrations -- migrate -t 'server-ce' # Note: They are run by default on container start. ``` To run all migrations in a SAAS environment use the rake task: + ```shell # list first and check that only your newly added migration is shown. If not, ask in the dev channel for help. rake deploy:migrations:list[staging] @@ -66,6 +68,7 @@ rake deploy:migrations[staging] ``` To run all migrations in the dev-env: + ```shell make services/web/migrate # Note: "make install" will pick them up as well @@ -81,4 +84,4 @@ For other options, or for information on how to roll migrations back, take a loo Try to use Mongo directly via the `db` object instead of using Mongoose models. Migrations will need to run in the future, and model files can change. It's unwise to make the migrations depend on code which might change. -**Note:** Running `east rollback` without any arguments rolls back *all* migrations, which you may well not want. +**Note:** Running `east rollback` without any arguments rolls back _all_ migrations, which you may well not want. diff --git a/tools/migrations/package.json b/tools/migrations/package.json index 7368dfeeda..c54b5b8910 100644 --- a/tools/migrations/package.json +++ b/tools/migrations/package.json @@ -3,9 +3,7 @@ "scripts": { "migrations": "MONGO_SOCKET_TIMEOUT=0 east --es-modules", "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", - "format": "prettier --list-different $PWD/'**/*.{mjs,js,cjs,ts}'", - "format:fix": "prettier --write $PWD/'**/*.{mjs,js,cjs,ts}'" + "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts ." }, "dependencies": { "@overleaf/logger": "*", diff --git a/tools/migrations/tsconfig.json b/tools/migrations/tsconfig.json index 5a53f3a3e6..ba77918a68 100644 --- a/tools/migrations/tsconfig.json +++ b/tools/migrations/tsconfig.json @@ -1,9 +1,4 @@ { "extends": "../../tsconfig.backend.json", - "include": [ - "**/*.js", - "**/*.cjs", - "**/*.mjs", - "**/*.ts" - ] + "include": ["**/*.js", "**/*.cjs", "**/*.mjs", "**/*.ts"] } diff --git a/tsconfig.backend.json b/tsconfig.backend.json index 926dfc6300..31a45a1b15 100644 --- a/tsconfig.backend.json +++ b/tsconfig.backend.json @@ -8,7 +8,9 @@ "noEmit": true, "noImplicitAny": false, "paths": { - "@overleaf/access-token-encryptor": ["./libraries/access-token-encryptor"], + "@overleaf/access-token-encryptor": [ + "./libraries/access-token-encryptor" + ], "@overleaf/fetch-utils": ["./libraries/fetch-utils"], "@overleaf/logger": ["./libraries/logger"], "@overleaf/metrics": ["./libraries/metrics"],