[WEB-4810] feat: migrate to tsdown from tsup (#7679)

* feat: migrat to tsdown to tsup

* fix: build scripts

* fix: lock file fixes

* fix: adding build process to i18n and propel packages

* fix: lint warning

* chore: update services module entry points

* fix: lock file

* fix: lock file

* fix: remove tsc from build

* fix: tsdown configs

* fix: remove tsc step from build process

---------

Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
Co-authored-by: Aaron Reisman <aaron.reisman@plane.so>
This commit is contained in:
sriram veeraghanta 2025-09-03 14:01:57 +05:30 committed by GitHub
parent 91f0228b5f
commit b99ddc24e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
38 changed files with 663 additions and 539 deletions

View File

@ -7,8 +7,8 @@
"private": true,
"type": "module",
"scripts": {
"dev": "tsup --watch --onSuccess 'node --env-file=.env dist/server.js'",
"build": "tsc --noEmit && tsup",
"build": "tsdown",
"dev": "tsdown --watch",
"start": "node --env-file=.env dist/server.js",
"check:lint": "eslint . --max-warnings 10",
"check:types": "tsc --noEmit",
@ -58,7 +58,7 @@
"concurrently": "^9.0.1",
"nodemon": "^3.1.7",
"ts-node": "^10.9.2",
"tsup": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:",
"ws": "^8.18.3"
}

View File

@ -21,6 +21,6 @@
"emitDecoratorMetadata": true,
"sourceRoot": "/"
},
"include": ["src/**/*.ts", "tsup.config.ts"],
"include": ["src/**/*.ts", "tsdown.config.ts"],
"exclude": ["./dist", "./build", "./node_modules"]
}

View File

@ -0,0 +1,7 @@
import { defineConfig } from "tsdown";
export default defineConfig({
entry: ["src/server.ts"],
outDir: "dist",
format: ["esm", "cjs"],
});

View File

@ -1,15 +0,0 @@
import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/server.ts"],
format: ["esm", "cjs"],
dts: true,
splitting: false,
sourcemap: true,
minify: false,
target: "node18",
outDir: "dist",
env: {
NODE_ENV: process.env.NODE_ENV || "development",
},
});

View File

@ -17,8 +17,8 @@
}
},
"scripts": {
"dev": "tsup --watch",
"build": "tsc --noEmit && tsup",
"dev": "tsdown --watch",
"build": "tsdown",
"check:lint": "eslint . --max-warnings 0",
"check:types": "tsc --noEmit",
"check:format": "prettier --check \"**/*.{ts,tsx,md,json,css,scss}\"",
@ -34,7 +34,7 @@
"@plane/typescript-config": "workspace:*",
"@types/node": "^22.5.4",
"@types/react": "catalog:",
"tsup": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
}
}

View File

@ -0,0 +1,7 @@
import { defineConfig } from "tsdown";
export default defineConfig({
entry: ["src/index.ts"],
outDir: "dist",
format: ["esm", "cjs"],
});

View File

@ -1,13 +0,0 @@
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: ["@plane/types"],
});

View File

@ -11,8 +11,8 @@
"dist/**"
],
"scripts": {
"build": "tsc --noEmit && tsup --minify",
"dev": "tsup --watch",
"build": "tsdown",
"dev": "tsdown --watch",
"check:lint": "eslint . --max-warnings 1",
"check:types": "tsc --noEmit",
"check:format": "prettier --check \"**/*.{ts,tsx,md,json,css,scss}\"",
@ -27,7 +27,7 @@
"@types/node": "^20.14.9",
"@types/ws": "^8.5.10",
"reflect-metadata": "^0.2.2",
"tsup": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
}
}

View File

@ -0,0 +1,7 @@
import { defineConfig } from "tsdown";
export default defineConfig({
entry: ["src/index.ts"],
outDir: "dist",
format: ["esm", "cjs"],
});

View File

@ -22,8 +22,8 @@
}
},
"scripts": {
"build": "tsc && tsup --minify",
"dev": "tsup --watch",
"build": "tsdown",
"dev": "tsdown --watch",
"check:lint": "eslint . --max-warnings 30",
"check:types": "tsc --noEmit",
"check:format": "prettier --check \"**/*.{ts,tsx,md,json,css,scss}\"",
@ -88,7 +88,7 @@
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"postcss": "^8.4.38",
"tsup": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
},
"keywords": [

View File

@ -0,0 +1,7 @@
import { defineConfig } from "tsdown";
export default defineConfig({
entry: ["src/index.ts", "src/lib.ts"],
outDir: "dist",
format: ["esm", "cjs"],
});

View File

@ -1,14 +0,0 @@
import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/index.ts", "src/lib.ts"],
outDir: "dist",
format: ["esm", "cjs"],
dts: true,
clean: true,
external: ["react", "react-dom"],
injectStyle: true,
splitting: true,
treeshake: true,
minify: true,
});

View File

@ -11,8 +11,8 @@
"dist/**"
],
"scripts": {
"build": "tsup --minify",
"dev": "tsup --watch",
"build": "tsdown",
"dev": "tsdown --watch",
"check:lint": "eslint . --max-warnings 6",
"check:types": "tsc --noEmit",
"check:format": "prettier --check \"**/*.{ts,tsx,md,json,css,scss}\"",
@ -28,7 +28,7 @@
"@plane/typescript-config": "workspace:*",
"@types/node": "^22.5.4",
"@types/react": "catalog:",
"tsup": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
}
}

View File

@ -1,12 +1,11 @@
import { defineConfig } from "tsup";
import { defineConfig } from "tsdown";
export default defineConfig({
entry: ["src/index.ts"],
outDir: "dist",
format: ["esm", "cjs"],
external: ["react", "react-dom"],
dts: true,
sourcemap: true,
clean: true,
minify: true,
external: ["express", "ws"],
treeshake: true,
});

View File

@ -1,13 +0,0 @@
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"],
});

View File

@ -4,10 +4,13 @@
"license": "AGPL-3.0",
"description": "I18n shared across multiple apps internally",
"private": true,
"main": "./src/index.ts",
"types": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"scripts": {
"check:lint": "eslint . --max-warnings 0",
"dev": "tsdown --watch",
"build": "tsdown",
"check:lint": "eslint . --max-warnings 2",
"check:types": "tsc --noEmit",
"check:format": "prettier --check \"**/*.{ts,tsx,md,json,css,scss}\"",
"fix:lint": "eslint . --fix",
@ -19,7 +22,8 @@
"intl-messageformat": "^10.7.11",
"mobx": "catalog:",
"mobx-react": "catalog:",
"lodash": "catalog:"
"lodash": "catalog:",
"react": "catalog:"
},
"devDependencies": {
"@plane/eslint-config": "workspace:*",
@ -27,6 +31,7 @@
"@types/node": "^22.5.4",
"@types/lodash": "catalog:",
"@types/react": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
}
}

View File

@ -2,3 +2,5 @@ export * from "./constants";
export * from "./context";
export * from "./hooks";
export * from "./types";
export * from "./store";
export * from "./locales";

View File

@ -0,0 +1,105 @@
// Export all locale files to make them accessible from the package root
export { default as enCore } from "./en/core.json";
export { default as enTranslations } from "./en/translations.json";
export { default as enAccessibility } from "./en/accessibility.json";
export { default as enEditor } from "./en/editor.json";
// Export locale data for all supported languages
export const locales = {
en: {
core: () => import("./en/core.json"),
translations: () => import("./en/translations.json"),
accessibility: () => import("./en/accessibility.json"),
editor: () => import("./en/editor.json"),
},
fr: {
translations: () => import("./fr/translations.json"),
accessibility: () => import("./fr/accessibility.json"),
editor: () => import("./fr/editor.json"),
},
es: {
translations: () => import("./es/translations.json"),
accessibility: () => import("./es/accessibility.json"),
editor: () => import("./es/editor.json"),
},
ja: {
translations: () => import("./ja/translations.json"),
accessibility: () => import("./ja/accessibility.json"),
editor: () => import("./ja/editor.json"),
},
"zh-CN": {
translations: () => import("./zh-CN/translations.json"),
accessibility: () => import("./zh-CN/accessibility.json"),
editor: () => import("./zh-CN/editor.json"),
},
"zh-TW": {
translations: () => import("./zh-TW/translations.json"),
accessibility: () => import("./zh-TW/accessibility.json"),
editor: () => import("./zh-TW/editor.json"),
},
ru: {
translations: () => import("./ru/translations.json"),
accessibility: () => import("./ru/accessibility.json"),
editor: () => import("./ru/editor.json"),
},
it: {
translations: () => import("./it/translations.json"),
accessibility: () => import("./it/accessibility.json"),
editor: () => import("./it/editor.json"),
},
cs: {
translations: () => import("./cs/translations.json"),
accessibility: () => import("./cs/accessibility.json"),
editor: () => import("./cs/editor.json"),
},
sk: {
translations: () => import("./sk/translations.json"),
accessibility: () => import("./sk/accessibility.json"),
editor: () => import("./sk/editor.json"),
},
de: {
translations: () => import("./de/translations.json"),
accessibility: () => import("./de/accessibility.json"),
editor: () => import("./de/editor.json"),
},
ua: {
translations: () => import("./ua/translations.json"),
accessibility: () => import("./ua/accessibility.json"),
editor: () => import("./ua/editor.json"),
},
pl: {
translations: () => import("./pl/translations.json"),
accessibility: () => import("./pl/accessibility.json"),
editor: () => import("./pl/editor.json"),
},
ko: {
translations: () => import("./ko/translations.json"),
accessibility: () => import("./ko/accessibility.json"),
editor: () => import("./ko/editor.json"),
},
"pt-BR": {
translations: () => import("./pt-BR/translations.json"),
accessibility: () => import("./pt-BR/accessibility.json"),
editor: () => import("./pt-BR/editor.json"),
},
id: {
translations: () => import("./id/translations.json"),
accessibility: () => import("./id/accessibility.json"),
editor: () => import("./id/editor.json"),
},
ro: {
translations: () => import("./ro/translations.json"),
accessibility: () => import("./ro/accessibility.json"),
editor: () => import("./ro/editor.json"),
},
"vi-VN": {
translations: () => import("./vi-VN/translations.json"),
accessibility: () => import("./vi-VN/accessibility.json"),
editor: () => import("./vi-VN/editor.json"),
},
"tr-TR": {
translations: () => import("./tr-TR/translations.json"),
accessibility: () => import("./tr-TR/accessibility.json"),
editor: () => import("./tr-TR/editor.json"),
},
};

View File

@ -5,7 +5,7 @@ import { makeAutoObservable, runInAction } from "mobx";
// constants
import { FALLBACK_LANGUAGE, SUPPORTED_LANGUAGES, LANGUAGE_STORAGE_KEY, ETranslationFiles } from "../constants";
// core translations imports
import coreEn from "../locales/en/core.json";
import { enCore, locales } from "../locales";
// types
import { TLanguage, ILanguageOption, ITranslations } from "../types";
@ -17,7 +17,7 @@ import { TLanguage, ILanguageOption, ITranslations } from "../types";
export class TranslationStore {
// Core translations that are always loaded
private coreTranslations: ITranslations = {
en: coreEn,
en: enCore,
};
// List of translations for each language
private translations: ITranslations = {};
@ -138,10 +138,24 @@ export class TranslationStore {
*/
private async importAndMergeFiles(language: TLanguage, files: string[]) {
try {
const importPromises = files.map((file) => import(`../locales/${language}/${file}.json`));
const localeData = locales[language as keyof typeof locales];
if (!localeData) {
throw new Error(`Locale data not found for language: ${language}`);
}
// Filter out files that don't exist for this language
const availableFiles = files.filter((file) => {
const fileKey = file as keyof typeof localeData;
return fileKey in localeData;
});
const importPromises = availableFiles.map((file) => {
const fileKey = file as keyof typeof localeData;
return localeData[fileKey]();
});
const modules = await Promise.all(importPromises);
const merged = modules.reduce((acc, module) => merge(acc, module.default), {});
const merged = modules.reduce((acc: any, module: any) => merge(acc, module.default), {});
return { default: merged };
} catch (error) {
throw new Error(`Failed to import and merge files for ${language}: ${error}`);

View File

@ -0,0 +1,10 @@
import { defineConfig } from "tsdown";
export default defineConfig({
entry: ["src/index.ts"],
outDir: "dist",
format: ["esm", "cjs"],
dts: true,
external: ["react", "lodash", "mobx", "mobx-react", "intl-messageformat"],
sourcemap: true,
});

View File

@ -18,8 +18,8 @@
"dist/**"
],
"scripts": {
"build": "tsup --minify",
"dev": "tsup --watch",
"build": "tsdown",
"dev": "tsdown --watch",
"check:lint": "eslint . --max-warnings 0",
"check:types": "tsc --noEmit",
"check:format": "prettier --check \"**/*.{ts,tsx,md,json,css,scss}\"",
@ -36,7 +36,7 @@
"@plane/typescript-config": "workspace:*",
"@types/express": "^4.17.21",
"@types/node": "^20.14.9",
"tsup": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
}
}

View File

@ -1,10 +1,10 @@
import { defineConfig } from "tsup";
import { defineConfig } from "tsdown";
export default defineConfig({
entry: ["src/index.ts"],
outDir: "dist",
format: ["esm", "cjs"],
dts: true,
sourcemap: true,
clean: true,
minify: true,
});

View File

@ -1,13 +0,0 @@
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: ["winston", "winston-daily-rotate-file"],
});

View File

@ -4,6 +4,8 @@
"private": true,
"license": "AGPL-3.0",
"scripts": {
"dev": "tsdown --watch",
"build": "tsdown",
"check:lint": "eslint . --max-warnings 7",
"check:types": "tsc --noEmit",
"check:format": "prettier --check \"**/*.{ts,tsx,md,json,css,scss}\"",
@ -57,6 +59,7 @@
"@types/react-dom": "catalog:",
"eslint-plugin-storybook": "^9.1.2",
"storybook": "^9.1.2",
"tsdown": "catalog:",
"typescript": "catalog:"
}
}

View File

@ -0,0 +1,21 @@
import { defineConfig } from "tsdown";
export default defineConfig({
entry: [
"src/avatar/index.ts",
"src/charts/index.ts",
"src/dialog/index.ts",
"src/menu/index.ts",
"src/table/index.ts",
"src/tabs/index.ts",
"src/popover/index.ts",
"src/command/index.ts",
"src/combobox/index.ts",
"src/tooltip/index.ts",
"src/card/index.ts",
"src/switch/index.ts",
],
outDir: "dist",
format: ["esm", "cjs"],
dts: true,
});

View File

@ -3,10 +3,15 @@
"version": "1.0.0",
"license": "AGPL-3.0",
"private": true,
"main": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist/**"
],
"scripts": {
"build": "tsc --noEmit && tsup --minify",
"dev": "tsup --watch",
"build": "tsdown",
"dev": "tsdown --watch",
"check:lint": "eslint . --max-warnings 62",
"check:types": "tsc --noEmit",
"check:format": "prettier --check \"**/*.{ts,tsx,md,json,css,scss}\"",
@ -22,7 +27,7 @@
"devDependencies": {
"@plane/eslint-config": "workspace:*",
"@plane/typescript-config": "workspace:*",
"tsup": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
}
}

View File

@ -0,0 +1,7 @@
import { defineConfig } from "tsdown";
export default defineConfig({
entry: ["src/index.ts"],
outDir: "dist",
format: ["esm", "cjs"],
});

View File

@ -1,13 +0,0 @@
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"],
});

View File

@ -17,8 +17,8 @@
}
},
"scripts": {
"dev": "tsup --watch",
"build": "tsc --noEmit && tsup --minify",
"dev": "tsdown --watch",
"build": "tsdown",
"check:lint": "eslint . --max-warnings 36",
"check:types": "tsc --noEmit",
"check:format": "prettier --check \"**/*.{ts,tsx,md,json,css,scss}\"",
@ -35,7 +35,7 @@
"@plane/typescript-config": "workspace:*",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"tsup": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
}
}

View File

@ -0,0 +1,7 @@
import { defineConfig } from "tsdown";
export default defineConfig({
entry: ["src/index.ts"],
outDir: "dist",
format: ["esm", "cjs"],
});

View File

@ -12,8 +12,8 @@
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsup --minify",
"dev": "tsup --watch",
"build": "tsdown",
"dev": "tsdown --watch",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"postcss": "postcss styles/globals.css -o styles/output.css --watch",
@ -76,7 +76,7 @@
"postcss-cli": "^11.0.0",
"postcss-nested": "^6.0.1",
"storybook": "^8.1.1",
"tsup": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
}
}

View File

@ -0,0 +1,7 @@
import { defineConfig } from "tsdown";
export default defineConfig({
entry: ["src/index.ts"],
outDir: "dist",
format: ["esm", "cjs"],
});

View File

@ -1,14 +0,0 @@
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", "@plane/types"],
injectStyle: true,
});

View File

@ -11,8 +11,8 @@
"dist"
],
"scripts": {
"build": "tsc --noEmit && tsup --minify",
"dev": "tsup --watch",
"build": "tsdown",
"dev": "tsdown --watch",
"check:lint": "eslint . --max-warnings 20",
"check:types": "tsc --noEmit",
"check:format": "prettier --check \"**/*.{ts,tsx,md,json,css,scss}\"",
@ -40,7 +40,7 @@
"@types/node": "^22.5.4",
"@types/react": "catalog:",
"@types/uuid": "^9.0.8",
"tsup": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
}
}

View File

@ -0,0 +1,7 @@
import { defineConfig } from "tsdown";
export default defineConfig({
entry: ["src/index.ts"],
outDir: "dist",
format: ["esm", "cjs"],
});

View File

@ -1,13 +0,0 @@
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"],
});

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ catalog:
"@types/react": 18.3.11
"@types/react-dom": 18.3.1
typescript: 5.8.3
tsup: 8.4.0
tsdown: 0.14.2
uuid: 10.0.0
onlyBuiltDependencies: