From 30aefb47f98623227858cea2b20d166240b2f8d2 Mon Sep 17 00:00:00 2001 From: wancat Date: Thu, 21 Dec 2023 13:45:29 +0800 Subject: [PATCH] feat: setup project reference --- packages/constants/package.json | 7 +++-- packages/constants/tsconfig.json | 9 ++++++ packages/file-graph/tsconfig.json | 11 ++----- packages/models/tsconfig.json | 11 ++----- packages/utils/tsconfig.json | 11 ++----- server/package.json | 5 ++-- server/tsconfig.json | 16 +++++----- tsconfig.json | 5 +--- yarn.lock | 50 +++++++++++++++++++++++++++++-- 9 files changed, 81 insertions(+), 44 deletions(-) create mode 100644 packages/constants/tsconfig.json diff --git a/packages/constants/package.json b/packages/constants/package.json index 3e34c03..3203b7c 100644 --- a/packages/constants/package.json +++ b/packages/constants/package.json @@ -1,9 +1,10 @@ { "name": "@linux-odyssey/constants", - "type": "module", + "type": "commonjs", "version": "1.0.0", "private": true, - "main": "index.js", - "exports": "./index.js", + "main": "dist/index.js", + "exports": "./dist/index.js", + "types": "dist/index.d.ts", "license": "GPL" } diff --git a/packages/constants/tsconfig.json b/packages/constants/tsconfig.json new file mode 100644 index 0000000..6760492 --- /dev/null +++ b/packages/constants/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "./dist", + "composite": true + }, + "include": ["*.js", "*.ts"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/file-graph/tsconfig.json b/packages/file-graph/tsconfig.json index 70955d7..7db1a2d 100644 --- a/packages/file-graph/tsconfig.json +++ b/packages/file-graph/tsconfig.json @@ -1,14 +1,9 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "target": "ES5", - "module": "CommonJS", - "moduleResolution": "node", - "strict": true, - "esModuleInterop": true, + "rootDir": "src", "outDir": "./dist", - "declaration": true, - "sourceMap": true, - "allowJs": true + "composite": true }, "include": ["src"], "exclude": ["node_modules", "dist"] diff --git a/packages/models/tsconfig.json b/packages/models/tsconfig.json index 70955d7..7db1a2d 100644 --- a/packages/models/tsconfig.json +++ b/packages/models/tsconfig.json @@ -1,14 +1,9 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "target": "ES5", - "module": "CommonJS", - "moduleResolution": "node", - "strict": true, - "esModuleInterop": true, + "rootDir": "src", "outDir": "./dist", - "declaration": true, - "sourceMap": true, - "allowJs": true + "composite": true }, "include": ["src"], "exclude": ["node_modules", "dist"] diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json index 76ff63c..7db1a2d 100644 --- a/packages/utils/tsconfig.json +++ b/packages/utils/tsconfig.json @@ -1,14 +1,9 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "target": "ES2020", - "module": "CommonJS", - "moduleResolution": "node", - "strict": true, - "esModuleInterop": true, + "rootDir": "src", "outDir": "./dist", - "declaration": true, - "sourceMap": true, - "allowJs": true + "composite": true }, "include": ["src"], "exclude": ["node_modules", "dist"] diff --git a/server/package.json b/server/package.json index 156e0bb..8cf7db5 100644 --- a/server/package.json +++ b/server/package.json @@ -5,11 +5,11 @@ "type": "commonjs", "scripts": { "start": "node dist/index.js", - "dev": "nodemon", + "dev": "concurrently \"yarn build -w\" \"nodemon\"", "test": "yarn node --experimental-vm-modules $(yarn bin jest)", "setup": "node dist/cli/setup.js", "clean": "node dist/cli/clean.js", - "build": "tsc", + "build": "tsc --build", "build:quests": "node src/cli/build.js" }, "dependencies": { @@ -43,6 +43,7 @@ "devDependencies": { "@types/express": "^4.17.21", "@types/express-session": "^1.17.10", + "concurrently": "^8.2.2", "jest": "^29.6.1", "nodemon": "^3.0.1", "typescript": "^5.3.3" diff --git a/server/tsconfig.json b/server/tsconfig.json index b76b77d..1e08a53 100644 --- a/server/tsconfig.json +++ b/server/tsconfig.json @@ -1,14 +1,14 @@ { + "extends": "../tsconfig.json", "compilerOptions": { - "target": "ES5", - "module": "CommonJS", - "moduleResolution": "Node", - "strict": true, - "esModuleInterop": true, - "outDir": "./dist", - "declaration": true, - "allowJs": true + "outDir": "./dist" }, + "references": [ + { "path": "../packages/models" }, + { "path": "../packages/utils" }, + { "path": "../packages/constants" }, + { "path": "../packages/file-graph" } + ], "include": ["src"], "exclude": ["node_modules", "src/*.test.js", "dist"] } diff --git a/tsconfig.json b/tsconfig.json index 76ff63c..a448336 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,11 +5,8 @@ "moduleResolution": "node", "strict": true, "esModuleInterop": true, - "outDir": "./dist", "declaration": true, "sourceMap": true, "allowJs": true - }, - "include": ["src"], - "exclude": ["node_modules", "dist"] + } } diff --git a/yarn.lock b/yarn.lock index b7faf58..6aed2bd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -338,6 +338,13 @@ dependencies: regenerator-runtime "^0.14.0" +"@babel/runtime@^7.21.0": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.6.tgz#c05e610dc228855dc92ef1b53d07389ed8ab521d" + integrity sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ== + dependencies: + regenerator-runtime "^0.14.0" + "@babel/template@^7.22.15": version "7.22.15" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" @@ -2178,7 +2185,7 @@ chalk@^2.0.0, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0, chalk@^4.1.0: +chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -2369,6 +2376,21 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== +concurrently@^8.2.2: + version "8.2.2" + resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-8.2.2.tgz#353141985c198cfa5e4a3ef90082c336b5851784" + integrity sha512-1dP4gpXFhei8IOtlXRE/T/4H88ElHgTiUzh71YUmtjTEHMSRS2Z/fgOxHSxxusGHogsRfxNq1vyAwxSC+EVyDg== + dependencies: + chalk "^4.1.2" + date-fns "^2.30.0" + lodash "^4.17.21" + rxjs "^7.8.1" + shell-quote "^1.8.1" + spawn-command "0.0.2" + supports-color "^8.1.1" + tree-kill "^1.2.2" + yargs "^17.7.2" + confusing-browser-globals@^1.0.10: version "1.0.11" resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz#ae40e9b57cdd3915408a2805ebd3a5585608dc81" @@ -2532,6 +2554,13 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +date-fns@^2.30.0: + version "2.30.0" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz#f367e644839ff57894ec6ac480de40cae4b0f4d0" + integrity sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw== + dependencies: + "@babel/runtime" "^7.21.0" + dayjs@^1.10.4: version "1.11.10" resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.10.tgz#68acea85317a6e164457d6d6947564029a6a16a0" @@ -6276,7 +6305,7 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -rxjs@^7.5.1: +rxjs@^7.5.1, rxjs@^7.8.1: version "7.8.1" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== @@ -6404,6 +6433,11 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +shell-quote@^1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.8.1.tgz#6dbf4db75515ad5bac63b4f1894c3a154c766680" + integrity sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA== + side-channel@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" @@ -6538,6 +6572,11 @@ sparse-bitfield@^3.0.3: dependencies: memory-pager "^1.0.2" +spawn-command@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2.tgz#9544e1a43ca045f8531aac1a48cb29bdae62338e" + integrity sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ== + split-ca@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/split-ca/-/split-ca-1.0.1.tgz#6c83aff3692fa61256e0cd197e05e9de157691a6" @@ -6955,6 +6994,11 @@ tr46@~0.0.3: resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== +tree-kill@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" + integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== + triple-beam@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.4.1.tgz#6fde70271dc6e5d73ca0c3b24e2d92afb7441984" @@ -7514,7 +7558,7 @@ yargs-parser@^21.0.1, yargs-parser@^21.1.1: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs@^17.3.1: +yargs@^17.3.1, yargs@^17.7.2: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==