- src/lib/first-run.ts settles where data lives (asked once, remembered in a pointer under the user's config dir), creates the owner-only key that protects stored camera logins, and reports whether MediaMTX is installed. Without a terminal nothing prompts: defaults are taken and logged, so a service still starts. Running it again changes nothing. - cli/onvif-dashboard.mjs is the published command: setup, install-video and help. Node runs the TypeScript in src/lib directly, so the CLI needs no build of its own. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { fileURLToPath } from "node:url";
|
|
import react from "@vitejs/plugin-react";
|
|
import { defineConfig } from "vitest/config";
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
// Resolves the "@/*" path alias from tsconfig.json.
|
|
tsconfigPaths: true,
|
|
alias: {
|
|
// The real package throws unless bundled for React Server Components.
|
|
"server-only": fileURLToPath(new URL("./test/server-only.ts", import.meta.url)),
|
|
},
|
|
},
|
|
test: {
|
|
// Server code runs in Node; component tests opt in with `// @vitest-environment jsdom`.
|
|
environment: "node",
|
|
include: ["src/**/*.test.{ts,tsx}", "scripts/**/*.test.ts", "cli/**/*.test.ts"],
|
|
restoreMocks: true,
|
|
unstubEnvs: true,
|
|
coverage: {
|
|
provider: "v8",
|
|
include: ["src/**/*.{ts,tsx}"],
|
|
exclude: [
|
|
"src/**/*.test.{ts,tsx}",
|
|
"src/**/*.d.ts",
|
|
// Async Server Component: unit runners can't render it (Next docs, testing/vitest.md).
|
|
"src/app/page.tsx",
|
|
],
|
|
reporter: ["text", "json-summary"],
|
|
// vrek principle pri-be2smzk: `npm run coverage` fails if line coverage drops below 95%.
|
|
thresholds: { lines: 95 },
|
|
},
|
|
},
|
|
});
|