diff --git a/package.json b/package.json index 8963100..0827ed4 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "docs:dev": "vitepress dev docs", "docs:build": "vitepress build docs", "docs:preview": "vitepress preview docs", + "build:site": "pnpm --filter '@tabmesh/playground^...' build && pnpm --filter @tabmesh/playground build && pnpm docs:build && mkdir -p docs/.vitepress/dist/playground && cp -R packages/playground/dist/. docs/.vitepress/dist/playground/", "biome:check": "biome check .", "biome:fix": "biome check --apply .", "biome:ci": "biome ci .", diff --git a/packages/playground/vite.config.ts b/packages/playground/vite.config.ts index 5f9a42c..fa5103e 100644 --- a/packages/playground/vite.config.ts +++ b/packages/playground/vite.config.ts @@ -1,9 +1,14 @@ import react from '@vitejs/plugin-react'; import { defineConfig } from 'vite'; -export default defineConfig({ +// In production the playground is served from tabmesh.dev/playground/ (the +// docs site iframes it). Dev keeps base `/` so the existing Playwright +// e2e suite, which hits the Vite dev server at http://localhost:5173/, +// is unaffected. +export default defineConfig(({ command }) => ({ plugins: [react()], + base: command === 'build' ? '/playground/' : '/', server: { port: 5173, }, -}); +})); diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..134ff97 --- /dev/null +++ b/vercel.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://openapi.vercel.sh/vercel.json", + "buildCommand": "pnpm run build:site", + "installCommand": "pnpm install --frozen-lockfile", + "outputDirectory": "docs/.vitepress/dist", + "framework": null, + "cleanUrls": true, + "trailingSlash": false +}