From d2081074c446ed5d61e3aef42bdfb8e217f74f6c 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/tsup.config.ts | 32 ++++++++++++++++++++++++--- 2 files changed, 31 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 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/slimy-brooms-smoke.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/localizations/tsup.config.ts b/packages/localizations/tsup.config.ts index a275cf81727..cc43f0ceada 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,