From df4ea1f7acc929895c6d22307161c3039ca35ed9 Mon Sep 17 00:00:00 2001 From: sriram veeraghanta Date: Fri, 18 Jul 2025 15:04:31 +0530 Subject: [PATCH] fix: update tsup build packages (#7438) --- package.json | 2 +- packages/constants/package.json | 7 +++---- packages/constants/tsconfig.json | 7 ++----- packages/constants/tsup.config.ts | 5 ++++- packages/decorators/.eslintrc.js | 4 ---- packages/decorators/tsup.config.ts | 4 ++-- packages/editor/package.json | 6 +++--- packages/editor/tsup.config.ts | 17 ++++++++++------- packages/hooks/tsup.config.ts | 4 ++++ packages/logger/tsup.config.ts | 7 ++++--- packages/services/.eslintrc.js | 3 --- packages/services/package.json | 8 ++++++++ packages/services/tsup.config.ts | 13 +++++++++++++ packages/types/package.json | 9 ++++----- packages/types/tsconfig.json | 8 ++------ packages/types/tsup.config.ts | 2 +- packages/ui/.eslintrc.js | 4 ---- packages/ui/package.json | 8 ++++---- packages/ui/tsup.config.ts | 17 ++++++++++------- packages/utils/package.json | 2 +- packages/utils/tsup.config.ts | 5 +++++ 21 files changed, 81 insertions(+), 61 deletions(-) create mode 100644 packages/services/tsup.config.ts diff --git a/package.json b/package.json index 9d47cde35..1524e6341 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ ], "scripts": { "build": "turbo run build", - "dev": "turbo run dev --concurrency=13", + "dev": "turbo run dev --concurrency=18", "start": "turbo run start", "clean": "turbo run clean", "fix": "turbo run fix", diff --git a/packages/constants/package.json b/packages/constants/package.json index c1cb63b66..fb7449e96 100644 --- a/packages/constants/package.json +++ b/packages/constants/package.json @@ -3,13 +3,12 @@ "version": "0.27.1", "private": true, "license": "AGPL-3.0", - "type": "module", - "main": "./dist/index.js", - "module": "./dist/index.js", - "types": "./dist/index.d.ts", "files": [ "dist/**/*" ], + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", "exports": { ".": { "types": "./dist/index.d.ts", diff --git a/packages/constants/tsconfig.json b/packages/constants/tsconfig.json index f64308b49..076ae8775 100644 --- a/packages/constants/tsconfig.json +++ b/packages/constants/tsconfig.json @@ -1,11 +1,8 @@ { "extends": "@plane/typescript-config/base.json", "compilerOptions": { - "outDir": "./dist", - "rootDir": "./src", - "module": "ESNext", - "moduleResolution": "bundler", - "target": "ESNext", + "outDir": "dist", + "rootDir": "src", "sourceMap": true, "strictNullChecks": true, "allowSyntheticDefaultImports": true diff --git a/packages/constants/tsup.config.ts b/packages/constants/tsup.config.ts index 4688d2c2c..79fe86a0e 100644 --- a/packages/constants/tsup.config.ts +++ b/packages/constants/tsup.config.ts @@ -3,8 +3,11 @@ import { defineConfig } from "tsup"; export default defineConfig({ entry: ["src/index.ts"], outDir: "dist", - format: ["esm"], + format: ["esm", "cjs"], dts: true, clean: true, minify: true, + splitting: true, + treeshake: true, + external: ["@plane/types"], }); diff --git a/packages/decorators/.eslintrc.js b/packages/decorators/.eslintrc.js index c1728ac28..b11b7bb6d 100644 --- a/packages/decorators/.eslintrc.js +++ b/packages/decorators/.eslintrc.js @@ -3,8 +3,4 @@ module.exports = { root: true, extends: ["@plane/eslint-config/library.js"], parser: "@typescript-eslint/parser", - parserOptions: { - project: true, - }, }; - diff --git a/packages/decorators/tsup.config.ts b/packages/decorators/tsup.config.ts index f89f98328..6ca042953 100644 --- a/packages/decorators/tsup.config.ts +++ b/packages/decorators/tsup.config.ts @@ -2,11 +2,11 @@ import { defineConfig } from "tsup"; export default defineConfig({ entry: ["src/index.ts"], + outDir: "dist", format: ["esm", "cjs"], dts: true, - splitting: false, - sourcemap: true, clean: true, + minify: true, external: ["express", "ws"], treeshake: true, }); diff --git a/packages/editor/package.json b/packages/editor/package.json index 4b326e019..4d0767e6a 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -4,12 +4,12 @@ "description": "Core Editor that powers Plane", "license": "AGPL-3.0", "private": true, + "files": [ + "dist" + ], "main": "./dist/index.mjs", "module": "./dist/index.mjs", "types": "./dist/index.d.mts", - "files": [ - "dist/**/*" - ], "exports": { ".": { "types": "./dist/index.d.mts", diff --git a/packages/editor/tsup.config.ts b/packages/editor/tsup.config.ts index c378c0b2b..1089c00b1 100644 --- a/packages/editor/tsup.config.ts +++ b/packages/editor/tsup.config.ts @@ -1,11 +1,14 @@ -import { defineConfig, Options } from "tsup"; +import { defineConfig } from "tsup"; -export default defineConfig((options: Options) => ({ +export default defineConfig({ entry: ["src/index.ts", "src/lib.ts"], - format: ["cjs", "esm"], + outDir: "dist", + format: ["esm", "cjs"], dts: true, - clean: false, - external: ["react"], + clean: true, + external: ["react", "react-dom"], injectStyle: true, - ...options, -})); + splitting: true, + treeshake: true, + minify: true, +}); diff --git a/packages/hooks/tsup.config.ts b/packages/hooks/tsup.config.ts index c69daf158..6566c82ef 100644 --- a/packages/hooks/tsup.config.ts +++ b/packages/hooks/tsup.config.ts @@ -2,8 +2,12 @@ import { defineConfig } from "tsup"; export default defineConfig({ entry: ["src/index.ts"], + outDir: "dist", format: ["esm", "cjs"], dts: true, clean: true, + minify: true, + splitting: true, + treeshake: true, external: ["react"], }); diff --git a/packages/logger/tsup.config.ts b/packages/logger/tsup.config.ts index 85bf72fce..01d63fe27 100644 --- a/packages/logger/tsup.config.ts +++ b/packages/logger/tsup.config.ts @@ -2,11 +2,12 @@ import { defineConfig } from "tsup"; export default defineConfig({ entry: ["src/index.ts"], + outDir: "dist", format: ["esm", "cjs"], dts: true, - splitting: false, - sourcemap: true, clean: true, - external: ["winston", "winston-daily-rotate-file"], + minify: true, + splitting: true, treeshake: true, + external: ["winston", "winston-daily-rotate-file"], }); diff --git a/packages/services/.eslintrc.js b/packages/services/.eslintrc.js index 558b8f76e..b11b7bb6d 100644 --- a/packages/services/.eslintrc.js +++ b/packages/services/.eslintrc.js @@ -3,7 +3,4 @@ module.exports = { root: true, extends: ["@plane/eslint-config/library.js"], parser: "@typescript-eslint/parser", - parserOptions: { - project: true, - }, }; diff --git a/packages/services/package.json b/packages/services/package.json index d3eacd9ce..952fb2fa1 100644 --- a/packages/services/package.json +++ b/packages/services/package.json @@ -5,6 +5,8 @@ "private": true, "main": "./src/index.ts", "scripts": { + "build": "tsc --noEmit && tsup --minify", + "dev": "tsup --watch", "check:lint": "eslint . --max-warnings 0", "check:types": "tsc --noEmit", "check:format": "prettier --check \"**/*.{ts,tsx,md,json,css,scss}\"", @@ -15,5 +17,11 @@ "dependencies": { "@plane/constants": "*", "axios": "^1.8.3" + }, + "devDependencies": { + "@plane/eslint-config": "*", + "@plane/typescript-config": "*", + "tsup": "8.4.0", + "typescript": "5.8.3" } } diff --git a/packages/services/tsup.config.ts b/packages/services/tsup.config.ts new file mode 100644 index 000000000..cb6ac8b2a --- /dev/null +++ b/packages/services/tsup.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from "tsup"; + +export default defineConfig({ + entry: ["src/index.ts"], + outDir: "dist", + format: ["esm", "cjs"], + dts: true, + clean: true, + minify: true, + splitting: true, + treeshake: true, + external: ["axios"], +}); diff --git a/packages/types/package.json b/packages/types/package.json index 6965ddf66..78eeeddd7 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -3,13 +3,12 @@ "version": "0.27.1", "license": "AGPL-3.0", "private": true, - "type": "module", + "files": [ + "dist" + ], "types": "./dist/index.d.ts", "main": "./dist/index.js", "module": "./dist/index.js", - "files": [ - "dist/**/*" - ], "exports": { ".": { "types": "./dist/index.d.ts", @@ -19,7 +18,7 @@ }, "scripts": { "dev": "tsup --watch", - "build": "tsc --noEmit && tsup", + "build": "tsc --noEmit && tsup --minify", "check:lint": "eslint . --max-warnings 0", "check:types": "tsc --noEmit", "check:format": "prettier --check \"**/*.{ts,tsx,md,json,css,scss}\"", diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json index 9d48e155e..9a94573fb 100644 --- a/packages/types/tsconfig.json +++ b/packages/types/tsconfig.json @@ -1,12 +1,8 @@ { "extends": "@plane/typescript-config/base.json", "compilerOptions": { - "outDir": "./dist", - "rootDir": "./src", - "baseUrl": "./src", - "module": "ESNext", - "moduleResolution": "bundler", - "target": "ESNext", + "outDir": "dist", + "rootDir": "src", "allowSyntheticDefaultImports": true, "strictNullChecks": true }, diff --git a/packages/types/tsup.config.ts b/packages/types/tsup.config.ts index 4688d2c2c..04ad41425 100644 --- a/packages/types/tsup.config.ts +++ b/packages/types/tsup.config.ts @@ -3,7 +3,7 @@ import { defineConfig } from "tsup"; export default defineConfig({ entry: ["src/index.ts"], outDir: "dist", - format: ["esm"], + format: ["esm", "cjs"], dts: true, clean: true, minify: true, diff --git a/packages/ui/.eslintrc.js b/packages/ui/.eslintrc.js index 1b79b55f3..b11b7bb6d 100644 --- a/packages/ui/.eslintrc.js +++ b/packages/ui/.eslintrc.js @@ -3,8 +3,4 @@ module.exports = { root: true, extends: ["@plane/eslint-config/library.js"], parser: "@typescript-eslint/parser", - parserOptions: { - project: "./tsconfig.json", - tsconfigRootDir: __dirname, - }, }; diff --git a/packages/ui/package.json b/packages/ui/package.json index 39fd039cc..e688e800e 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -3,14 +3,14 @@ "description": "UI components shared across multiple apps internally", "private": true, "version": "0.27.1", - "main": "./dist/index.js", - "module": "./dist/index.mjs", - "types": "./dist/index.d.ts", "sideEffects": false, "license": "AGPL-3.0", "files": [ - "dist/**" + "dist" ], + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", "scripts": { "build": "tsup --minify", "dev": "tsup --watch", diff --git a/packages/ui/tsup.config.ts b/packages/ui/tsup.config.ts index 5e89e04af..923124855 100644 --- a/packages/ui/tsup.config.ts +++ b/packages/ui/tsup.config.ts @@ -1,11 +1,14 @@ -import { defineConfig, Options } from "tsup"; +import { defineConfig } from "tsup"; -export default defineConfig((options: Options) => ({ +export default defineConfig({ entry: ["src/index.ts"], - format: ["cjs", "esm"], + outDir: "dist", + format: ["esm", "cjs"], dts: true, - clean: false, - external: ["react"], + clean: true, + minify: true, + splitting: true, + treeshake: true, + external: ["react", "@plane/types"], injectStyle: true, - ...options, -})); +}); diff --git a/packages/utils/package.json b/packages/utils/package.json index 86ce63428..d1c423120 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -8,7 +8,7 @@ "module": "./dist/index.mjs", "types": "./dist/index.d.ts", "files": [ - "dist/**" + "dist" ], "scripts": { "build": "tsc --noEmit && tsup --minify", diff --git a/packages/utils/tsup.config.ts b/packages/utils/tsup.config.ts index b8d2a4b6e..6566c82ef 100644 --- a/packages/utils/tsup.config.ts +++ b/packages/utils/tsup.config.ts @@ -2,7 +2,12 @@ import { defineConfig } from "tsup"; export default defineConfig({ entry: ["src/index.ts"], + outDir: "dist", format: ["esm", "cjs"], dts: true, + clean: true, + minify: true, + splitting: true, + treeshake: true, external: ["react"], });