From b4e43265bb04912127c2b79e21885e2877dd26bf Mon Sep 17 00:00:00 2001 From: Dimitris Klouvas Date: Fri, 1 Dec 2023 14:25:29 +0200 Subject: [PATCH] fix(localizations): Fix building of retheme subpath exports Before the localizations subpath exports change we had a single entrypoint, the `index`. Based on the CLERK_RETHEME env we were using the index.retheme.ts or the index.ts as entrypoint during build. To support that type of conditional output for all the exported subpaths we need to either define a callback to replace the *.retheme files with the *.ts files or conditional choose them in buiild configuration. Due to some issues with the tsup `onSuccess` callback i manually defined all the subpath exports. We need to be careful in the future and add the new localization files in both package.json#files, tsup.config.ts and in subpaths.mjs file to support subpath exports successfully --- .changeset/slimy-brooms-smoke.md | 2 ++ packages/localizations/src/index.retheme.ts | 2 ++ packages/localizations/tsup.config.ts | 32 +++++++++++++++++++-- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 .changeset/slimy-brooms-smoke.md diff --git a/.changeset/slimy-brooms-smoke.md b/.changeset/slimy-brooms-smoke.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/slimy-brooms-smoke.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/localizations/src/index.retheme.ts b/packages/localizations/src/index.retheme.ts index 2189990273..4e884d4a41 100644 --- a/packages/localizations/src/index.retheme.ts +++ b/packages/localizations/src/index.retheme.ts @@ -14,6 +14,7 @@ export { jaJP } from './ja-JP'; export { heIL } from './he-IL'; export { csCZ } from './cs-CZ'; export { zhCN } from './zh-CN'; +export { zhTW } from './zh-TW'; export { koKR } from './ko-KR'; export { nbNO } from './nb-NO'; export { viVN } from './vi-VN'; @@ -21,3 +22,4 @@ export { plPL } from './pl-PL'; export { elGR } from './el-GR'; export { skSK } from './sk-SK'; export { ukUA } from './uk-UA'; +export { roRO } from './ro-RO'; diff --git a/packages/localizations/tsup.config.ts b/packages/localizations/tsup.config.ts index a275cf8172..cc43f0cead 100644 --- a/packages/localizations/tsup.config.ts +++ b/packages/localizations/tsup.config.ts @@ -4,9 +4,35 @@ export default defineConfig(_overrideOptions => { const uiRetheme = process.env.CLERK_RETHEME === '1' || process.env.CLERK_RETHEME === 'true'; return { - entry: uiRetheme - ? ['src', '!src/index.ts', '!src/en-US.ts'] - : ['src', '!src/index.retheme.ts', '!src/en-US.retheme.ts'], + entry: { + index: uiRetheme ? 'src/index.retheme.ts' : 'src/index.ts', + 'en-US': uiRetheme ? 'src/en-US.retheme.ts' : 'src/en-US.ts', + 'ar-SA': 'src/ar-SA.ts', + 'cs-CZ': 'src/cs-CZ.ts', + 'da-DK': 'src/da-DK.ts', + 'de-DE': 'src/de-DE.ts', + 'el-GR': 'src/el-GR.ts', + 'es-ES': 'src/es-ES.ts', + 'fr-FR': 'src/fr-FR.ts', + 'he-IL': 'src/he-IL.ts', + 'it-IT': 'src/it-IT.ts', + 'ja-JP': 'src/ja-JP.ts', + 'ko-KR': 'src/ko-KR.ts', + 'nb-NO': 'src/nb-NO.ts', + 'nl-NL': 'src/nl-NL.ts', + 'pl-PL': 'src/pl-PL.ts', + 'pt-BR': 'src/pt-BR.ts', + 'pt-PT': 'src/pt-PT.ts', + 'ro-RO': 'src/ro-RO.ts', + 'ru-RU': 'src/ru-RU.ts', + 'sk-SK': 'src/sk-SK.ts', + 'sv-SE': 'src/sv-SE.ts', + 'tr-TR': 'src/tr-TR.ts', + 'uk-UA': 'src/uk-UA.ts', + 'vi-VN': 'src/vi-VN.ts', + 'zh-CN': 'src/zh-CN.ts', + 'zh-TW': 'src/zh-TW.ts', + }, format: ['cjs', 'esm'], bundle: true, clean: true,