Make convert remaining js config files to ts

Co-authored-by: hughns
Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
Timo K
2025-08-04 18:50:57 +02:00
parent 518039f7c3
commit e133289a7f
4 changed files with 44 additions and 10 deletions

View File

@@ -1,4 +1,12 @@
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 +34,5 @@ export default {
input: ["src/**/*.{ts,tsx}"],
sort: true,
};
export default config;

View File

@@ -1,7 +1,15 @@
/*
Copyright 2025 New Vector Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import { defineConfig, mergeConfig } from "vite";
import fullConfig from "./vite.config";
import generateFile from "vite-plugin-generate-file";
import fullConfig from "./vite.config";
const base = "./";
// Config for embedded deployments (possibly hosted under a non-root path)

View File

@@ -5,7 +5,12 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import { defineConfig, loadEnv, searchForWorkspaceRoot } from "vite";
import {
loadEnv,
searchForWorkspaceRoot,
type ConfigEnv,
type UserConfig,
} from "vite";
import svgrPlugin from "vite-plugin-svgr";
import { createHtmlPlugin } from "vite-plugin-html";
import { codecovVitePlugin } from "@codecov/vite-plugin";
@@ -13,12 +18,16 @@ import { sentryVitePlugin } from "@sentry/vite-plugin";
import react from "@vitejs/plugin-react";
import { realpathSync } from "fs";
import * as fs from "node:fs";
import { logger } from "matrix-js-sdk/lib/logger";
// https://vitejs.dev/config/
export default defineConfig(({ mode, packageType }) => {
// Modified type helper from defineConfig to allow for packageType (see defineConfig from vite)
export default ({
mode,
packageType,
}: ConfigEnv & { packageType?: "full" | "embedded" }): UserConfig => {
const env = loadEnv(mode, process.cwd());
// Environment variables with the VITE_ prefix are accessible at runtime.
// So, we set this to allow for build/package specific behaviour.
// So, we set this to allow for build/package specific behavior.
// In future we might be able to do what is needed via code splitting at
// build time.
process.env.VITE_PACKAGE = packageType ?? "full";
@@ -77,7 +86,7 @@ export default defineConfig(({ mode, packageType }) => {
allow.push(realpathSync(path));
} catch {}
}
console.log("Allowed vite paths:", allow);
logger.log("Allowed vite paths:", allow);
return {
server: {
@@ -93,7 +102,7 @@ export default defineConfig(({ mode, packageType }) => {
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
@@ -143,4 +152,4 @@ export default defineConfig(({ mode, packageType }) => {
exclude: ["@matrix-org/matrix-sdk-crypto-wasm"],
},
};
});
};

View File

@@ -1,5 +1,12 @@
/*
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(