Files
paseo/vitest.config.ts
T
Mohamed Boudra d87998bc8c feat(website): serve paseo.sh in Simplified Chinese
Every page of the website now has a Simplified Chinese version under
/zh-CN: the interface, docs, blog posts, comparison pages, legal pages,
all changelog releases and the homepage mockup. English URLs are unchanged.

The URL alone decides the language. There is no browser-language redirect
and no stored preference, because either would have to redirect the
unprefixed English URLs that people share and search engines index.
Internal links carry the page's language instead, and hreflang alternates
point Chinese search results at /zh-CN.

Translated headings pin the English anchor with {#id}, so section links
work in both languages. content-translations.test.ts fails when a page
has no translation or a translation's headings drift from the English.
Changelog releases and plugin listings without a translation render
whole in English under a notice, so a release never waits on one.

Plugin manifests and the registry gain optional translations and
OVERVIEW.zh-CN.md fields; older clients and registries ignore them.
2026-10-19 08:30:45 +02:00

75 lines
2.6 KiB
TypeScript

import fs from "node:fs";
import path from "node:path";
import { configDefaults, defineConfig } from "vitest/config";
// React's test APIs require its development build, even in a production shell.
process.env.NODE_ENV = "test";
const appDir = path.resolve(__dirname, "packages/app");
const appNodeModules = path.resolve(appDir, "node_modules");
const rootNodeModules = path.resolve(__dirname, "node_modules");
const resolvePackageEntry = (packageName: string) => {
const appPackagePath = path.resolve(appNodeModules, packageName);
return fs.existsSync(appPackagePath)
? appPackagePath
: path.resolve(rootNodeModules, packageName);
};
export default defineConfig({
resolve: {
extensions: [
".web.mjs",
".web.js",
".web.mts",
".web.ts",
".web.jsx",
".web.tsx",
".mjs",
".js",
".mts",
".ts",
".jsx",
".tsx",
".json",
],
alias: [
{
find: /^@getpaseo\/relay\/e2ee$/,
replacement: path.resolve(__dirname, "packages/relay/src/e2ee.ts"),
},
{
find: /^@getpaseo\/relay$/,
replacement: path.resolve(__dirname, "packages/relay/src/index.ts"),
},
{ find: "@", replacement: path.resolve(appDir, "src") },
// The website's `~/` path alias, as in packages/website/tsconfig.json.
{ find: /^~\/(.*)$/, replacement: path.resolve(__dirname, "packages/website/src/$1") },
{ find: "@server", replacement: path.resolve(__dirname, "packages/server/src") },
{
find: "react-native",
replacement: path.resolve(rootNodeModules, "react-native-web/dist/index.js"),
},
{ find: "react", replacement: resolvePackageEntry("react") },
{ find: "react-dom", replacement: resolvePackageEntry("react-dom") },
{
find: /^@xterm\/addon-ligatures\/lib\/addon-ligatures\.mjs$/,
replacement: path.resolve(appDir, "test-stubs/xterm-addon-ligatures.ts"),
},
{
find: /^@xterm\/addon-ligatures$/,
replacement: path.resolve(appDir, "test-stubs/xterm-addon-ligatures.ts"),
},
],
},
test: {
// Fake-timer suites freeze p-throttle's clock, so a real per-second cap deadlocks them.
env: {
PASEO_GIT_MAX_PROCESSES_PER_SECOND: "10000",
},
exclude: [...configDefaults.exclude, "**/.claude/**", "**/.dev/**"],
// The website installs its own React; bundling its router lets tests render website components
// that use router hooks against the one React the tests use.
server: { deps: { inline: [/packages\/website\/node_modules\/@tanstack\/(react-)?router/] } },
},
});