From 99c5a1a250064b8fca7af84a5c6b1e831d55beea Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Wed, 18 Dec 2024 13:32:19 +0000 Subject: [PATCH] Use .ts files for vite config for type safety --- i18next-parser.config.ts | 13 ++++++++++++- tsconfig.json | 4 +++- vite.config.js => vite.config.ts | 11 +++++++---- vitest.config.js => vitest.config.ts | 10 +++++++++- 4 files changed, 31 insertions(+), 7 deletions(-) rename vite.config.js => vite.config.ts (90%) rename vitest.config.js => vitest.config.ts (75%) diff --git a/i18next-parser.config.ts b/i18next-parser.config.ts index 3acf2b5e4..9c949ed23 100644 --- a/i18next-parser.config.ts +++ b/i18next-parser.config.ts @@ -1,4 +1,13 @@ -export default { +/* +Copyright 2024 New Vector Ltd. + +SPDX-License-Identifier: AGPL-3.0-only +Please see LICENSE in the repository root for full details. +*/ + +import type { UserConfig } from "i18next-parser"; + +const config: UserConfig = { keySeparator: ".", namespaceSeparator: false, contextSeparator: "|", @@ -26,3 +35,5 @@ export default { input: ["src/**/*.{ts,tsx}"], sort: true, }; + +export default config; diff --git a/tsconfig.json b/tsconfig.json index 0f0c9c946..f053c6846 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,6 +18,7 @@ // Workaround for https://github.com/microsoft/TypeScript/issues/55132 "useDefineForClassFields": false, "allowImportingTsExtensions": true, + "skipLibCheck": true, "paths": { // These imports within @livekit/components-core and // @livekit/components-react are broken under the "bundler" module @@ -50,6 +51,7 @@ "include": [ "./node_modules/matrix-js-sdk/src/@types/*.d.ts", "./src/**/*.ts", - "./src/**/*.tsx" + "./src/**/*.tsx", + "*.ts" ] } diff --git a/vite.config.js b/vite.config.ts similarity index 90% rename from vite.config.js rename to vite.config.ts index 1feb7d662..e1da2d4f4 100644 --- a/vite.config.js +++ b/vite.config.ts @@ -28,7 +28,8 @@ export default defineConfig(({ mode }) => { ref: true, }, }), - htmlTemplate.default({ + // types workaround for https://github.com/IndexXuan/vite-plugin-html-template/issues/37 + (htmlTemplate as unknown as { default: typeof htmlTemplate }).default({ data: { title: env.VITE_PRODUCT_NAME || "Element Call", }, @@ -53,8 +54,10 @@ export default defineConfig(({ mode }) => { ) { plugins.push( sentryVitePlugin({ - include: "./dist", - release: process.env.VITE_APP_VERSION, + release: { + dist: process.env.VITE_APP_VERSION, + name: process.env.VITE_APP_VERSION, + }, }), ); } @@ -67,7 +70,7 @@ export default defineConfig(({ mode }) => { sourcemap: true, rollupOptions: { output: { - assetFileNames: ({ originalFileNames }) => { + assetFileNames: ({ originalFileNames }): string => { if (originalFileNames) { for (const name of originalFileNames) { // Custom asset name for locales to include the locale code in the filename diff --git a/vitest.config.js b/vitest.config.ts similarity index 75% rename from vitest.config.js rename to vitest.config.ts index 098a0b0c0..5eb5ec1e9 100644 --- a/vitest.config.js +++ b/vitest.config.ts @@ -1,5 +1,13 @@ +/* +Copyright 2024 New Vector Ltd. + +SPDX-License-Identifier: AGPL-3.0-only +Please see LICENSE in the repository root for full details. +*/ + import { defineConfig, mergeConfig } from "vitest/config"; -import viteConfig from "./vite.config.js"; + +import viteConfig from "./vite.config"; export default defineConfig((configEnv) => mergeConfig(