From e87df4a791f581d6984bbb3d06e8533554a1b2b2 Mon Sep 17 00:00:00 2001 From: Eric Mc Sween <5454374+emcsween@users.noreply.github.com> Date: Mon, 6 May 2024 07:57:39 -0400 Subject: [PATCH] Merge pull request #18167 from overleaf/em-simpler-typescript-backend Simpler Typescript setup in the backend GitOrigin-RevId: 3a90f26a5ac8029d14203faa98008375ce933e7d --- libraries/access-token-encryptor/package.json | 5 +---- libraries/access-token-encryptor/tsconfig.json | 4 ---- libraries/fetch-utils/package.json | 5 +---- libraries/fetch-utils/tsconfig.json | 4 ---- libraries/logger/package.json | 5 +---- libraries/logger/tsconfig.json | 4 ---- libraries/metrics/package.json | 5 +---- libraries/metrics/tsconfig.json | 4 ---- libraries/o-error/package.json | 8 ++------ libraries/o-error/tsconfig.json | 4 ---- libraries/object-persistor/package.json | 5 +---- libraries/object-persistor/tsconfig.json | 4 ---- libraries/overleaf-editor-core/package.json | 5 +---- libraries/overleaf-editor-core/tsconfig.json | 4 ---- libraries/promise-utils/package.json | 5 +---- libraries/promise-utils/tsconfig.json | 4 ---- libraries/ranges-tracker/index.cjs | 1 - libraries/ranges-tracker/package.json | 5 +---- libraries/ranges-tracker/tsconfig.json | 4 ---- libraries/redis-wrapper/RedisLocker.js | 12 ++++++++++++ libraries/redis-wrapper/package.json | 5 +---- libraries/redis-wrapper/tsconfig.json | 4 ---- libraries/settings/package.json | 5 +---- libraries/settings/tsconfig.json | 4 ---- libraries/stream-utils/package.json | 5 +---- libraries/stream-utils/tsconfig.json | 4 ---- package-lock.json | 12 ++++++------ services/chat/Makefile | 5 +---- services/clsi/Makefile | 5 +---- services/contacts/Makefile | 5 +---- services/docstore/Makefile | 5 +---- services/document-updater/Makefile | 5 +---- services/document-updater/app/js/types.ts | 2 +- services/filestore/Makefile | 5 +---- services/history-v1/Makefile | 5 +---- .../history-v1/storage/lib/project_archive.js | 2 +- services/notifications/Makefile | 5 +---- services/project-history/Makefile | 5 +---- services/real-time/Makefile | 5 +---- services/spelling/Makefile | 5 +---- services/web/Dockerfile | 4 +--- services/web/tsconfig.json | 4 +++- tsconfig.backend.json | 15 +++++++++++++++ 43 files changed, 63 insertions(+), 155 deletions(-) diff --git a/libraries/access-token-encryptor/package.json b/libraries/access-token-encryptor/package.json index 5c77dbbd05..c41dbfebcb 100644 --- a/libraries/access-token-encryptor/package.json +++ b/libraries/access-token-encryptor/package.json @@ -3,7 +3,6 @@ "version": "3.0.0", "description": "", "main": "index.js", - "types": "./types/index.d.ts", "scripts": { "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", "lint": "eslint --ext .js --ext .cjs --max-warnings 0 --format unix .", @@ -12,9 +11,7 @@ "format:fix": "prettier --write $PWD/'**/*.{js,cjs}'", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", - "types:build": "[ -d types ] || tsc --noEmit false --emitDeclarationOnly", - "types:check": "tsc --noEmit", - "types:rebuild": "rm -rf types && npm run types:build" + "types:check": "tsc --noEmit" }, "author": "", "license": "AGPL-3.0-only", diff --git a/libraries/access-token-encryptor/tsconfig.json b/libraries/access-token-encryptor/tsconfig.json index adf05e5a36..d43bb2470a 100644 --- a/libraries/access-token-encryptor/tsconfig.json +++ b/libraries/access-token-encryptor/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.backend.json", - "compilerOptions": { - "declaration": true, - "outDir": "types" - }, "include": [ "**/*.js", "**/*.cjs" diff --git a/libraries/fetch-utils/package.json b/libraries/fetch-utils/package.json index 9235391c3d..59e6328647 100644 --- a/libraries/fetch-utils/package.json +++ b/libraries/fetch-utils/package.json @@ -3,7 +3,6 @@ "version": "0.1.0", "description": "utilities for node-fetch", "main": "index.js", - "types": "types/index.d.ts", "scripts": { "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", "lint": "eslint --ext .js --ext .cjs --max-warnings 0 --format unix .", @@ -12,9 +11,7 @@ "format:fix": "prettier --write $PWD/'**/*.{js,cjs}'", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", - "types:build": "[ -d types ] || tsc --noEmit false --emitDeclarationOnly", - "types:check": "tsc --noEmit", - "types:rebuild": "rm -rf types && npm run types:build" + "types:check": "tsc --noEmit" }, "author": "Overleaf (https://www.overleaf.com)", "license": "AGPL-3.0-only", diff --git a/libraries/fetch-utils/tsconfig.json b/libraries/fetch-utils/tsconfig.json index adf05e5a36..d43bb2470a 100644 --- a/libraries/fetch-utils/tsconfig.json +++ b/libraries/fetch-utils/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.backend.json", - "compilerOptions": { - "declaration": true, - "outDir": "types" - }, "include": [ "**/*.js", "**/*.cjs" diff --git a/libraries/logger/package.json b/libraries/logger/package.json index 07ff0fa005..0feb75a04a 100644 --- a/libraries/logger/package.json +++ b/libraries/logger/package.json @@ -7,7 +7,6 @@ "url": "https://github.com/overleaf/overleaf" }, "main": "index.js", - "types": "types/index.d.ts", "license": "AGPL-3.0-only", "version": "3.1.1", "scripts": { @@ -18,9 +17,7 @@ "lint:fix": "eslint --fix --ext .js --ext .cjs .", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", - "types:build": "[ -d types ] || tsc --noEmit false --emitDeclarationOnly", - "types:check": "tsc --noEmit", - "types:rebuild": "rm -rf types && npm run types:build" + "types:check": "tsc --noEmit" }, "dependencies": { "@google-cloud/logging-bunyan": "^5.0.0", diff --git a/libraries/logger/tsconfig.json b/libraries/logger/tsconfig.json index adf05e5a36..d43bb2470a 100644 --- a/libraries/logger/tsconfig.json +++ b/libraries/logger/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.backend.json", - "compilerOptions": { - "declaration": true, - "outDir": "types" - }, "include": [ "**/*.js", "**/*.cjs" diff --git a/libraries/metrics/package.json b/libraries/metrics/package.json index 28abe32412..a0616bb8dc 100644 --- a/libraries/metrics/package.json +++ b/libraries/metrics/package.json @@ -7,7 +7,6 @@ "url": "https://github.com/overleaf/metrics-module.git" }, "main": "index.js", - "types": "types/index.d.ts", "dependencies": { "@google-cloud/opentelemetry-cloud-trace-exporter": "^2.1.0", "@google-cloud/profiler": "^6.0.0", @@ -38,9 +37,7 @@ "format": "prettier --list-different $PWD/'**/*.{js,cjs}'", "format:fix": "prettier --write $PWD/'**/*.{js,cjs}'", "test:ci": "npm run test:unit", - "types:build": "[ -d types ] || tsc --noEmit false --emitDeclarationOnly", - "types:check": "tsc --noEmit", - "types:rebuild": "rm -rf types && npm run types:build" + "types:check": "tsc --noEmit" }, "peerDependencies": { "@overleaf/logger": "*" diff --git a/libraries/metrics/tsconfig.json b/libraries/metrics/tsconfig.json index adf05e5a36..d43bb2470a 100644 --- a/libraries/metrics/tsconfig.json +++ b/libraries/metrics/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.backend.json", - "compilerOptions": { - "declaration": true, - "outDir": "types" - }, "include": [ "**/*.js", "**/*.cjs" diff --git a/libraries/o-error/package.json b/libraries/o-error/package.json index c41ccd4d3d..0c5f42bb35 100644 --- a/libraries/o-error/package.json +++ b/libraries/o-error/package.json @@ -13,10 +13,8 @@ "verror" ], "main": "index.cjs", - "types": "types/index.d.cts", "files": [ - "index.cjs", - "types/index.d.cts" + "index.cjs" ], "scripts": { "build": "npm run --silent test", @@ -27,9 +25,7 @@ "format:fix": "prettier --write $PWD/'**/*.{js,cjs}'", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", - "types:build": "[ -d types ] || tsc --noEmit false --emitDeclarationOnly", - "types:check": "tsc --noEmit", - "types:rebuild": "rm -rf types && npm run types:build" + "types:check": "tsc --noEmit" }, "author": "Overleaf (https://www.overleaf.com)", "license": "MIT", diff --git a/libraries/o-error/tsconfig.json b/libraries/o-error/tsconfig.json index adf05e5a36..d43bb2470a 100644 --- a/libraries/o-error/tsconfig.json +++ b/libraries/o-error/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.backend.json", - "compilerOptions": { - "declaration": true, - "outDir": "types" - }, "include": [ "**/*.js", "**/*.cjs" diff --git a/libraries/object-persistor/package.json b/libraries/object-persistor/package.json index f484c1e9d3..84f0fcce26 100644 --- a/libraries/object-persistor/package.json +++ b/libraries/object-persistor/package.json @@ -3,7 +3,6 @@ "version": "1.0.2", "description": "Module for storing objects in multiple backends, with fallback on 404 to assist migration between them", "main": "index.js", - "types": "types/index.d.ts", "scripts": { "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", @@ -12,9 +11,7 @@ "format": "prettier --list-different $PWD/'**/*.{js,cjs}'", "format:fix": "prettier --write $PWD/'**/*.{js,cjs}'", "test:ci": "npm run test:unit", - "types:build": "[ -d types ] || tsc --noEmit false --emitDeclarationOnly", - "types:check": "tsc --noEmit", - "types:rebuild": "rm -rf types && npm run types:build" + "types:check": "tsc --noEmit" }, "repository": { "type": "git", diff --git a/libraries/object-persistor/tsconfig.json b/libraries/object-persistor/tsconfig.json index adf05e5a36..d43bb2470a 100644 --- a/libraries/object-persistor/tsconfig.json +++ b/libraries/object-persistor/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.backend.json", - "compilerOptions": { - "declaration": true, - "outDir": "types" - }, "include": [ "**/*.js", "**/*.cjs" diff --git a/libraries/overleaf-editor-core/package.json b/libraries/overleaf-editor-core/package.json index 499f732500..1c57be6403 100644 --- a/libraries/overleaf-editor-core/package.json +++ b/libraries/overleaf-editor-core/package.json @@ -3,7 +3,6 @@ "version": "1.0.0", "description": "Library shared between the editor server and clients.", "main": "index.js", - "types": "types/index.d.ts", "scripts": { "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", "format": "prettier --list-different $PWD/'**/*.{js,cjs}'", @@ -12,9 +11,7 @@ "lint:fix": "eslint --fix --ext .js --ext .cjs .", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", - "types:build": "[ -d types ] || tsc --noEmit false --emitDeclarationOnly", - "types:check": "tsc --noEmit", - "types:rebuild": "rm -rf types && npm run types:build" + "types:check": "tsc --noEmit" }, "author": "team@overleaf.com", "license": "Proprietary", diff --git a/libraries/overleaf-editor-core/tsconfig.json b/libraries/overleaf-editor-core/tsconfig.json index adf05e5a36..d43bb2470a 100644 --- a/libraries/overleaf-editor-core/tsconfig.json +++ b/libraries/overleaf-editor-core/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.backend.json", - "compilerOptions": { - "declaration": true, - "outDir": "types" - }, "include": [ "**/*.js", "**/*.cjs" diff --git a/libraries/promise-utils/package.json b/libraries/promise-utils/package.json index 9ec129e3ff..c34cf645e3 100644 --- a/libraries/promise-utils/package.json +++ b/libraries/promise-utils/package.json @@ -3,7 +3,6 @@ "version": "0.1.0", "description": "utilities to help working with promises", "main": "index.js", - "types": "types/index.d.ts", "scripts": { "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", @@ -12,9 +11,7 @@ "format": "prettier --list-different $PWD/'**/*.{js,cjs}'", "format:fix": "prettier --write $PWD/'**/*.{js,cjs}'", "test:ci": "npm run test:unit", - "types:build": "[ -d types ] || tsc --noEmit false --emitDeclarationOnly", - "types:check": "tsc --noEmit", - "types:rebuild": "rm -rf types && npm run types:build" + "types:check": "tsc --noEmit" }, "author": "Overleaf (https://www.overleaf.com)", "license": "AGPL-3.0-only", diff --git a/libraries/promise-utils/tsconfig.json b/libraries/promise-utils/tsconfig.json index adf05e5a36..d43bb2470a 100644 --- a/libraries/promise-utils/tsconfig.json +++ b/libraries/promise-utils/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.backend.json", - "compilerOptions": { - "declaration": true, - "outDir": "types" - }, "include": [ "**/*.js", "**/*.cjs" diff --git a/libraries/ranges-tracker/index.cjs b/libraries/ranges-tracker/index.cjs index b02203221b..3f3f35aff6 100644 --- a/libraries/ranges-tracker/index.cjs +++ b/libraries/ranges-tracker/index.cjs @@ -1,4 +1,3 @@ -// @ts-check /** * The purpose of this class is to track a set of inserts and deletes to a document, like * track changes in Word. We store these as a set of ShareJs style ranges: diff --git a/libraries/ranges-tracker/package.json b/libraries/ranges-tracker/package.json index 5585d8215d..b72a16687a 100644 --- a/libraries/ranges-tracker/package.json +++ b/libraries/ranges-tracker/package.json @@ -2,7 +2,6 @@ "name": "@overleaf/ranges-tracker", "description": "Shared logic for syncing comments and tracked changes with operational transforms", "main": "index.cjs", - "types": "types/index.d.cts", "files": [ "index.cjs", "types" @@ -17,9 +16,7 @@ "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", - "types:build": "[ -d types ] || tsc --noEmit false --emitDeclarationOnly", - "types:check": "tsc --noEmit", - "types:rebuild": "rm -rf types && npm run types:build" + "types:check": "tsc --noEmit" }, "devDependencies": { "mocha": "^10.2.0", diff --git a/libraries/ranges-tracker/tsconfig.json b/libraries/ranges-tracker/tsconfig.json index adf05e5a36..d43bb2470a 100644 --- a/libraries/ranges-tracker/tsconfig.json +++ b/libraries/ranges-tracker/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.backend.json", - "compilerOptions": { - "declaration": true, - "outDir": "types" - }, "include": [ "**/*.js", "**/*.cjs" diff --git a/libraries/redis-wrapper/RedisLocker.js b/libraries/redis-wrapper/RedisLocker.js index 20598e33e5..9185927887 100644 --- a/libraries/redis-wrapper/RedisLocker.js +++ b/libraries/redis-wrapper/RedisLocker.js @@ -96,6 +96,9 @@ module.exports = class RedisLocker { return `locked:host=${HOST}:pid=${PID}:random=${RND}:time=${time}:count=${COUNT++}` } + /** + * @param {Callback} callback + */ tryLock(id, callback) { if (callback == null) { callback = function () {} @@ -135,6 +138,9 @@ module.exports = class RedisLocker { ) } + /** + * @param {Callback} callback + */ getLock(id, callback) { if (callback == null) { callback = function () {} @@ -166,6 +172,9 @@ module.exports = class RedisLocker { attempt() } + /** + * @param {Callback} callback + */ checkLock(id, callback) { if (callback == null) { callback = function () {} @@ -186,6 +195,9 @@ module.exports = class RedisLocker { }) } + /** + * @param {Callback} callback + */ releaseLock(id, lockValue, callback) { const key = this.getKey(id) return this.rclient.eval( diff --git a/libraries/redis-wrapper/package.json b/libraries/redis-wrapper/package.json index 9b33a7d730..8e9cedd58e 100644 --- a/libraries/redis-wrapper/package.json +++ b/libraries/redis-wrapper/package.json @@ -3,7 +3,6 @@ "version": "2.1.0", "description": "Redis wrapper for node which will either use cluster or single instance redis", "main": "index.js", - "types": "types/index.d.ts", "files": [ "index.js", "Errors.js", @@ -21,9 +20,7 @@ "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", - "types:build": "[ -d types ] || tsc --noEmit false --emitDeclarationOnly", - "types:check": "tsc --noEmit", - "types:rebuild": "rm -rf types && npm run types:build" + "types:check": "tsc --noEmit" }, "peerDependencies": { "@overleaf/logger": "*", diff --git a/libraries/redis-wrapper/tsconfig.json b/libraries/redis-wrapper/tsconfig.json index adf05e5a36..d43bb2470a 100644 --- a/libraries/redis-wrapper/tsconfig.json +++ b/libraries/redis-wrapper/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.backend.json", - "compilerOptions": { - "declaration": true, - "outDir": "types" - }, "include": [ "**/*.js", "**/*.cjs" diff --git a/libraries/settings/package.json b/libraries/settings/package.json index 98d5f6dd06..10e207352b 100644 --- a/libraries/settings/package.json +++ b/libraries/settings/package.json @@ -4,7 +4,6 @@ "version": "3.0.0", "repository": "overleaf/settings-module", "main": "index.js", - "types": "types/index.d.ts", "scripts": { "lint": "eslint --ext .js --ext .cjs --max-warnings 0 --format unix .", "lint:fix": "eslint --fix --ext .js --ext .cjs .", @@ -13,9 +12,7 @@ "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", - "types:build": "[ -d types ] || tsc --noEmit false --emitDeclarationOnly", - "types:check": "tsc --noEmit", - "types:rebuild": "rm -rf types && npm run types:build" + "types:check": "tsc --noEmit" }, "devDependencies": { "mocha": "^10.2.0", diff --git a/libraries/settings/tsconfig.json b/libraries/settings/tsconfig.json index adf05e5a36..d43bb2470a 100644 --- a/libraries/settings/tsconfig.json +++ b/libraries/settings/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.backend.json", - "compilerOptions": { - "declaration": true, - "outDir": "types" - }, "include": [ "**/*.js", "**/*.cjs" diff --git a/libraries/stream-utils/package.json b/libraries/stream-utils/package.json index 3328b77cc9..d5d8374918 100644 --- a/libraries/stream-utils/package.json +++ b/libraries/stream-utils/package.json @@ -3,7 +3,6 @@ "version": "0.1.0", "description": "stream handling utilities", "main": "index.js", - "types": "types/index.d.ts", "scripts": { "test": "npm run lint && npm run format && npm run types:check && npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", @@ -12,9 +11,7 @@ "format": "prettier --list-different $PWD/'**/*.{js,cjs}'", "format:fix": "prettier --write $PWD/'**/*.{js,cjs}'", "test:ci": "npm run test:unit", - "types:build": "[ -d types ] || tsc --noEmit false --emitDeclarationOnly", - "types:check": "tsc --noEmit", - "types:rebuild": "rm -rf types && npm run types:build" + "types:check": "tsc --noEmit" }, "author": "Overleaf (https://www.overleaf.com)", "license": "AGPL-3.0-only", diff --git a/libraries/stream-utils/tsconfig.json b/libraries/stream-utils/tsconfig.json index adf05e5a36..d43bb2470a 100644 --- a/libraries/stream-utils/tsconfig.json +++ b/libraries/stream-utils/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.backend.json", - "compilerOptions": { - "declaration": true, - "outDir": "types" - }, "include": [ "**/*.js", "**/*.cjs" diff --git a/package-lock.json b/package-lock.json index 9f64ebb80e..2807f79521 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38926,9 +38926,9 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, "node_modules/typescript": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -77933,9 +77933,9 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, "typescript": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "dev": true }, "typical": { diff --git a/services/chat/Makefile b/services/chat/Makefile index 5401c0d503..958d3d2426 100644 --- a/services/chat/Makefile +++ b/services/chat/Makefile @@ -48,10 +48,7 @@ lint: lint_fix: $(RUN_LINTING) lint:fix -build_types: - $(RUN_LINTING_MONOREPO) --workspaces --if-present types:build - -typecheck: build_types +typecheck: $(RUN_LINTING) types:check test: format lint typecheck test_unit test_acceptance diff --git a/services/clsi/Makefile b/services/clsi/Makefile index 02297a1bdc..95cab44bf1 100644 --- a/services/clsi/Makefile +++ b/services/clsi/Makefile @@ -48,10 +48,7 @@ lint: lint_fix: $(RUN_LINTING) lint:fix -build_types: - $(RUN_LINTING_MONOREPO) --workspaces --if-present types:build - -typecheck: build_types +typecheck: $(RUN_LINTING) types:check test: format lint typecheck test_unit test_acceptance diff --git a/services/contacts/Makefile b/services/contacts/Makefile index 3b2353a6b2..a8d8b9eafa 100644 --- a/services/contacts/Makefile +++ b/services/contacts/Makefile @@ -48,10 +48,7 @@ lint: lint_fix: $(RUN_LINTING) lint:fix -build_types: - $(RUN_LINTING_MONOREPO) --workspaces --if-present types:build - -typecheck: build_types +typecheck: $(RUN_LINTING) types:check test: format lint typecheck test_unit test_acceptance diff --git a/services/docstore/Makefile b/services/docstore/Makefile index f6adce7a43..1a33801fe7 100644 --- a/services/docstore/Makefile +++ b/services/docstore/Makefile @@ -48,10 +48,7 @@ lint: lint_fix: $(RUN_LINTING) lint:fix -build_types: - $(RUN_LINTING_MONOREPO) --workspaces --if-present types:build - -typecheck: build_types +typecheck: $(RUN_LINTING) types:check test: format lint typecheck test_unit test_acceptance diff --git a/services/document-updater/Makefile b/services/document-updater/Makefile index bb432773d7..2cea086b74 100644 --- a/services/document-updater/Makefile +++ b/services/document-updater/Makefile @@ -48,10 +48,7 @@ lint: lint_fix: $(RUN_LINTING) lint:fix -build_types: - $(RUN_LINTING_MONOREPO) --workspaces --if-present types:build - -typecheck: build_types +typecheck: $(RUN_LINTING) types:check test: format lint typecheck test_unit test_acceptance diff --git a/services/document-updater/app/js/types.ts b/services/document-updater/app/js/types.ts index b1533c22ff..eb18f030c7 100644 --- a/services/document-updater/app/js/types.ts +++ b/services/document-updater/app/js/types.ts @@ -1,4 +1,4 @@ -import { TrackingPropsRawData } from 'overleaf-editor-core/types/lib/types' +import { TrackingPropsRawData } from 'overleaf-editor-core/lib/types' /** * An update coming from the editor diff --git a/services/filestore/Makefile b/services/filestore/Makefile index 52ae78b6e5..759b9ee249 100644 --- a/services/filestore/Makefile +++ b/services/filestore/Makefile @@ -48,10 +48,7 @@ lint: lint_fix: $(RUN_LINTING) lint:fix -build_types: - $(RUN_LINTING_MONOREPO) --workspaces --if-present types:build - -typecheck: build_types +typecheck: $(RUN_LINTING) types:check test: format lint typecheck test_unit test_acceptance diff --git a/services/history-v1/Makefile b/services/history-v1/Makefile index 1bb74ea863..62335fe17f 100644 --- a/services/history-v1/Makefile +++ b/services/history-v1/Makefile @@ -48,10 +48,7 @@ lint: lint_fix: $(RUN_LINTING) lint:fix -build_types: - $(RUN_LINTING_MONOREPO) --workspaces --if-present types:build - -typecheck: build_types +typecheck: $(RUN_LINTING) types:check test: format lint typecheck test_unit test_acceptance diff --git a/services/history-v1/storage/lib/project_archive.js b/services/history-v1/storage/lib/project_archive.js index 31d3b62444..67858ea9cd 100644 --- a/services/history-v1/storage/lib/project_archive.js +++ b/services/history-v1/storage/lib/project_archive.js @@ -1,7 +1,7 @@ // @ts-check 'use strict' -/** @typedef {import('overleaf-editor-core/types').Snapshot} Snapshot */ +/** @typedef {import('overleaf-editor-core').Snapshot} Snapshot */ const Archive = require('archiver') const BPromise = require('bluebird') diff --git a/services/notifications/Makefile b/services/notifications/Makefile index 3e3c5dbae6..cea323e057 100644 --- a/services/notifications/Makefile +++ b/services/notifications/Makefile @@ -48,10 +48,7 @@ lint: lint_fix: $(RUN_LINTING) lint:fix -build_types: - $(RUN_LINTING_MONOREPO) --workspaces --if-present types:build - -typecheck: build_types +typecheck: $(RUN_LINTING) types:check test: format lint typecheck test_unit test_acceptance diff --git a/services/project-history/Makefile b/services/project-history/Makefile index d739cd6a7d..1013522b4f 100644 --- a/services/project-history/Makefile +++ b/services/project-history/Makefile @@ -48,10 +48,7 @@ lint: lint_fix: $(RUN_LINTING) lint:fix -build_types: - $(RUN_LINTING_MONOREPO) --workspaces --if-present types:build - -typecheck: build_types +typecheck: $(RUN_LINTING) types:check test: format lint typecheck test_unit test_acceptance diff --git a/services/real-time/Makefile b/services/real-time/Makefile index 6c1b00964f..63fa32138c 100644 --- a/services/real-time/Makefile +++ b/services/real-time/Makefile @@ -48,10 +48,7 @@ lint: lint_fix: $(RUN_LINTING) lint:fix -build_types: - $(RUN_LINTING_MONOREPO) --workspaces --if-present types:build - -typecheck: build_types +typecheck: $(RUN_LINTING) types:check test: format lint typecheck test_unit test_acceptance diff --git a/services/spelling/Makefile b/services/spelling/Makefile index 2bfc98632c..3f7389cb36 100644 --- a/services/spelling/Makefile +++ b/services/spelling/Makefile @@ -48,10 +48,7 @@ lint: lint_fix: $(RUN_LINTING) lint:fix -build_types: - $(RUN_LINTING_MONOREPO) --workspaces --if-present types:build - -typecheck: build_types +typecheck: $(RUN_LINTING) types:check test: format lint typecheck test_unit test_acceptance diff --git a/services/web/Dockerfile b/services/web/Dockerfile index d4488bc145..3b57ccb0f7 100644 --- a/services/web/Dockerfile +++ b/services/web/Dockerfile @@ -35,9 +35,7 @@ FROM deps-prod as deps ENV CYPRESS_INSTALL_BINARY=0 COPY tsconfig.backend.json /overleaf/ -RUN cd /overleaf \ - && npm install \ - && npm run --workspaces --if-present types:build +RUN cd /overleaf && npm install # the web image with only production dependencies but no webpack production build, for development FROM deps-prod as app-only diff --git a/services/web/tsconfig.json b/services/web/tsconfig.json index 0fcdb4b018..049642f997 100644 --- a/services/web/tsconfig.json +++ b/services/web/tsconfig.json @@ -12,7 +12,9 @@ "skipLibCheck": true /* Skip type checking of declaration files. */, "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */, "paths": { - "@/*": ["./frontend/js/*"] + "@/*": ["./frontend/js/*"], + "@overleaf/o-error": ["../../libraries/o-error"], + "@overleaf/ranges-tracker": ["../../libraries/ranges-tracker"] }, "types": ["cypress", "@testing-library/cypress"] }, diff --git a/tsconfig.backend.json b/tsconfig.backend.json index b0bc63f668..17237dd29a 100644 --- a/tsconfig.backend.json +++ b/tsconfig.backend.json @@ -5,6 +5,21 @@ "moduleResolution": "node", "noEmit": true, "noImplicitAny": false, + "paths": { + "@overleaf/access-token-encryptor": ["./libraries/access-token-encryptor"], + "@overleaf/fetch-utils": ["./libraries/fetch-utils"], + "@overleaf/logger": ["./libraries/logger"], + "@overleaf/metrics": ["./libraries/metrics"], + "@overleaf/object-persistor": ["./libraries/object-persistor"], + "@overleaf/o-error": ["./libraries/o-error"], + "overleaf-editor-core": ["./libraries/overleaf-editor-core"], + "@overleaf/piece-table": ["./libraries/piece-table"], + "@overleaf/promise-utils": ["./libraries/promise-utils"], + "@overleaf/ranges-tracker": ["./libraries/ranges-tracker"], + "@overleaf/redis-wrapper": ["./libraries/redis-wrapper"], + "@overleaf/settings": ["./libraries/settings"], + "@overleaf/stream-utils": ["./libraries/stream-utils"] + }, "skipLibCheck": true, "strict": true, "target": "ES2022"