This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / web / vite.config.ts
2.8 kB 93 lines
1import tailwindcss from "@tailwindcss/vite"; 2import { sveltekit } from "@sveltejs/kit/vite"; 3import Icons from "unplugin-icons/vite"; 4import { defineConfig } from "vitest/config"; 5import oauthMetadata from "./src/lib/oauth-client-metadata.json"; 6import path from "node:path"; 7import { fileURLToPath } from "node:url"; 8import { storybookTest } from "@storybook/addon-vitest/vitest-plugin"; 9import { playwright } from "@vitest/browser-playwright"; 10const dirname = 11 typeof __dirname !== "undefined" ? __dirname : path.dirname(fileURLToPath(import.meta.url)); 12 13// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon 14const devHost = process.env.VITE_DEV_HOST ?? "127.0.0.1"; 15const devPort = Number(process.env.VITE_DEV_PORT ?? 5173); 16// docker desktop's macos file sharing never forwards inotify to the container, 17// so an edit on the host lands on disk but the watcher never fires and hmr goes 18// stale. polling is the only way to see those writes, and only the container 19// needs it 20const watch = 21 process.env.VITE_WATCH_POLL === "true" ? { usePolling: true, interval: 300 } : undefined; 22const devRedirectUri = `http://127.0.0.1:${devPort}/oauth/callback`; 23const devClientId = `http://localhost?redirect_uri=${encodeURIComponent(devRedirectUri)}&scope=${encodeURIComponent(oauthMetadata.scope)}`; 24export default defineConfig({ 25 plugins: [ 26 { 27 name: "oauth-env", 28 config(_config, { command }) { 29 process.env.VITE_OAUTH_CLIENT_ID ??= 30 command === "serve" ? devClientId : oauthMetadata.client_id; 31 process.env.VITE_OAUTH_REDIRECT_URI ??= 32 command === "serve" ? devRedirectUri : oauthMetadata.redirect_uris[0]; 33 process.env.VITE_OAUTH_SCOPE ??= oauthMetadata.scope; 34 } 35 }, 36 tailwindcss(), 37 Icons({ 38 compiler: "svelte" 39 }), 40 sveltekit() 41 ], 42 resolve: { 43 alias: { 44 "$icon/": "~icons/lucide/" 45 } 46 }, 47 server: { 48 host: devHost, 49 port: devPort, 50 strictPort: true, 51 allowedHosts: [".ts.net"], 52 watch 53 }, 54 test: { 55 expect: { 56 requireAssertions: true 57 }, 58 projects: [ 59 { 60 extends: "./vite.config.ts", 61 test: { 62 name: "server", 63 environment: "node", 64 include: ["src/**/*.{test,spec}.{js,ts}"], 65 exclude: ["src/**/*.svelte.{test,spec}.{js,ts}"] 66 } 67 }, 68 { 69 extends: true, 70 plugins: [ 71 // The plugin will run tests for the stories defined in your Storybook config 72 // See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest 73 storybookTest({ 74 configDir: path.join(dirname, ".storybook") 75 }) 76 ], 77 test: { 78 name: "storybook", 79 browser: { 80 enabled: true, 81 headless: true, 82 provider: playwright({}), 83 instances: [ 84 { 85 browser: "chromium" 86 } 87 ] 88 } 89 } 90 } 91 ] 92 } 93});