From 429dc8f6d2b52350e64cfb14401bfbb96d20e23f Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 25 May 2023 11:49:18 +0200 Subject: [PATCH 1/3] Tidy up tsconfigs --- packages/server/tsconfig.build.json | 2 +- packages/server/tsconfig.json | 8 +------- packages/worker/tsconfig.json | 8 +------- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/packages/server/tsconfig.build.json b/packages/server/tsconfig.build.json index 355b7ed6da..bbce6a8bda 100644 --- a/packages/server/tsconfig.build.json +++ b/packages/server/tsconfig.build.json @@ -8,7 +8,7 @@ "esModuleInterop": true, "resolveJsonModule": true, "incremental": true, - "types": ["node", "jest"], + "types": ["node"], "outDir": "dist/src", "skipLibCheck": true, "baseUrl": ".", diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json index cf86094cd2..849e1e1a83 100644 --- a/packages/server/tsconfig.json +++ b/packages/server/tsconfig.json @@ -6,13 +6,7 @@ "sourceMap": true, "baseUrl": ".", "outDir": "dist", - "paths": { - "@budibase/types": ["../types/src"], - "@budibase/backend-core": ["../backend-core/src"], - "@budibase/backend-core/*": ["../backend-core/*"], - "@budibase/shared-core": ["../shared-core/src"], - "@budibase/pro": ["../pro/packages/pro/src"] - } + "types": ["node", "jest"] }, "ts-node": { "require": ["tsconfig-paths/register"], diff --git a/packages/worker/tsconfig.json b/packages/worker/tsconfig.json index 61f3f9f5e1..147ef1f700 100644 --- a/packages/worker/tsconfig.json +++ b/packages/worker/tsconfig.json @@ -4,13 +4,7 @@ "composite": true, "declaration": true, "sourceMap": true, - "baseUrl": ".", - "paths": { - "@budibase/types": ["../types/src"], - "@budibase/backend-core": ["../backend-core/src"], - "@budibase/backend-core/*": ["../backend-core/*"], - "@budibase/pro": ["../pro/packages/pro/src"] - } + "baseUrl": "." }, "ts-node": { "require": ["tsconfig-paths/register"], From bdda73a70bb91e42babd81ee5eeccfd38d0072b2 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 25 May 2023 11:49:38 +0200 Subject: [PATCH 2/3] Respect tsconfig paths --- package.json | 1 + scripts/build.js | 4 ++++ yarn.lock | 33 ++++++++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 277b213b78..edbb82b892 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "private": true, "devDependencies": { "@esbuild-plugins/node-resolve": "^0.2.2", + "@esbuild-plugins/tsconfig-paths": "^0.1.2", "@nx/esbuild": "16.2.1", "@nx/js": "16.2.1", "@rollup/plugin-json": "^4.0.2", diff --git a/scripts/build.js b/scripts/build.js index 986dbad13f..34f0a70d35 100755 --- a/scripts/build.js +++ b/scripts/build.js @@ -9,6 +9,9 @@ const path = require("path") const { build } = require("esbuild") const { default: NodeResolve } = require("@esbuild-plugins/node-resolve") +const { + default: TsconfigPathsPlugin, +} = require("@esbuild-plugins/tsconfig-paths") var argv = require("minimist")(process.argv.slice(2)) @@ -23,6 +26,7 @@ function runBuild(entry, outfile) { sourcemap: isDev, tsconfig, plugins: [ + TsconfigPathsPlugin({ tsconfig }), NodeResolve({ extensions: [".ts", ".js"], onResolved: resolved => { diff --git a/yarn.lock b/yarn.lock index 086342b0f2..e044074a50 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2047,6 +2047,15 @@ escape-string-regexp "^4.0.0" resolve "^1.19.0" +"@esbuild-plugins/tsconfig-paths@^0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@esbuild-plugins/tsconfig-paths/-/tsconfig-paths-0.1.2.tgz#1955de0a124ecf4364717a2fadbfbea876955232" + integrity sha512-TusFR26Y+Ze+Zm+NdfqZTSG4XyrXKxIaAfYCL3jASEI/gHjSdoCujATjzNWaaXs6Sk6Bv2D7NLr4Jdz1gysy/Q== + dependencies: + debug "^4.3.1" + find-up "^5.0.0" + strip-json-comments "^3.1.1" + "@esbuild/android-arm64@0.16.17": version "0.16.17" resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.16.17.tgz#cf91e86df127aa3d141744edafcba0abdc577d23" @@ -12085,6 +12094,14 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + findit2@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/findit2/-/findit2-2.2.3.tgz#58a466697df8a6205cdfdbf395536b8bd777a5f6" @@ -17012,6 +17029,13 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + lodash-es@^4.17.11: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" @@ -19371,7 +19395,7 @@ p-limit@^2.0.0, p-limit@^2.2.0: dependencies: p-try "^2.0.0" -p-limit@^3.1.0: +p-limit@^3.0.2, p-limit@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== @@ -19406,6 +19430,13 @@ p-locate@^4.1.0: dependencies: p-limit "^2.2.0" +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + p-map-series@2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/p-map-series/-/p-map-series-2.1.0.tgz#7560d4c452d9da0c07e692fdbfe6e2c81a2a91f2" From 014a4cd467160dc57ff5558fe80b4c4ba0b4e436 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 25 May 2023 12:22:53 +0200 Subject: [PATCH 3/3] Undo types --- packages/server/tsconfig.build.json | 2 +- packages/server/tsconfig.json | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/server/tsconfig.build.json b/packages/server/tsconfig.build.json index bbce6a8bda..355b7ed6da 100644 --- a/packages/server/tsconfig.build.json +++ b/packages/server/tsconfig.build.json @@ -8,7 +8,7 @@ "esModuleInterop": true, "resolveJsonModule": true, "incremental": true, - "types": ["node"], + "types": ["node", "jest"], "outDir": "dist/src", "skipLibCheck": true, "baseUrl": ".", diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json index 849e1e1a83..6e88b99c34 100644 --- a/packages/server/tsconfig.json +++ b/packages/server/tsconfig.json @@ -5,8 +5,7 @@ "declaration": true, "sourceMap": true, "baseUrl": ".", - "outDir": "dist", - "types": ["node", "jest"] + "outDir": "dist" }, "ts-node": { "require": ["tsconfig-paths/register"],