The repository now lives in the poli0981org organization, and this makes it at home there. - main was red since 2026-11-18: RUSTSEC-2026-0543 (chrono), in Cargo.lock only through serde_with's weak features and compiled into nothing; ignored with its reason and exit condition. - Supersedes #113–#118 (Rust 1.100.0, rusqlite 0.42.0, Tauri 2.12.6, code-health pins, actions, npm) plus jsdom 31.0.1; minimatch 11 closes GHSA-g3hv-75wg-m249. rfd 0.18 (#112) is held again until tauri-plugin-dialog moves. - Dependabot's tauri groups never worked (it picks the most specific group); exclude-patterns on the catch-alls fix it. - CI is self-contained: no workflow calls poli0981/.github; every action is pinned by commit; notify.yml vendors the Discord notifier. - npm licences: scripts/check-licenses.mjs, deny.toml's allowlist for the npm half. Required, with cargo deny and tauri lockstep — eight required checks. - Qodana in two parts (Rust, TS/JS), full scans, a triaged Rust baseline, fail on anything new. The Rust container needed its toolchain and CARGO_HOME pointed somewhere writable before it analysed anything. - SonarQube Cloud analyses into poli0981org_pipdock; every npm ci runs with --ignore-scripts (S6505). - Every repository URL points at the organization. README's attestation command for 1.4.0/1.5.0 had stopped working; it now says --owner poli0981 --signer-repo poli0981/pipdock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
91 lines
3.6 KiB
TypeScript
91 lines
3.6 KiB
TypeScript
import { readFileSync } from 'node:fs'
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
import type { Plugin } from 'vite'
|
|
import { defineConfig } from 'vitest/config'
|
|
import react from '@vitejs/plugin-react'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
|
|
/**
|
|
* The development Content-Security-Policy, injected by `vite dev` and by nothing else.
|
|
*
|
|
* A release build's policy is `app.security.csp` in tauri.conf.json, which Tauri injects itself.
|
|
* Development needs a looser `style-src` — Vite injects CSS as <style> elements — and that policy
|
|
* used to sit in index.html, where it was shipped in every release build as a second meta tag:
|
|
* harmless, since the stricter of two policies wins, but the weaker one was in the product. Read
|
|
* from `devCsp`, so the two policies are kept side by side in one file.
|
|
*/
|
|
function devCsp(): Plugin {
|
|
const conf = JSON.parse(
|
|
readFileSync(new URL('./src-tauri/tauri.conf.json', import.meta.url), 'utf8'),
|
|
) as { app: { security: { devCsp: string } } }
|
|
return {
|
|
name: 'pipdock-dev-csp',
|
|
apply: 'serve',
|
|
transformIndexHtml: () => [
|
|
{
|
|
tag: 'meta',
|
|
attrs: { 'http-equiv': 'Content-Security-Policy', content: conf.app.security.devCsp },
|
|
// After Vite's own head-prepend scripts (React Refresh's inline preamble), as the old
|
|
// meta in index.html was: a meta policy governs what follows it, and the preamble is
|
|
// dev-only tooling, not the app.
|
|
injectTo: 'head',
|
|
},
|
|
],
|
|
}
|
|
}
|
|
|
|
// The frontend lives in ui/ per ARCHITECTURE §2, but package.json sits at the repo root — first
|
|
// because the ops repo's reusable CI workflow had no working-directory input, and since CI went
|
|
// project-local (2026-11-21) because SonarCloud, Qodana, the scripts and Tauri's configuration all
|
|
// assume it. Hence root: './ui' with the bundle emitted to the repo-root dist/, which is where
|
|
// tauri.conf.json's frontendDist looks.
|
|
export default defineConfig({
|
|
root: './ui',
|
|
plugins: [react(), tailwindcss(), devCsp()],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./ui/src', import.meta.url)),
|
|
},
|
|
},
|
|
build: {
|
|
outDir: '../dist',
|
|
emptyOutDir: true,
|
|
// Tauri ships its own WebView2; there is no legacy browser to support.
|
|
target: 'esnext',
|
|
// No source maps: Tauri embeds dist/ in the executable, so `sourcemap: true` shipped 2 MB of
|
|
// them to every user, and nothing in a release build ever reads one (X51).
|
|
sourcemap: false,
|
|
},
|
|
server: {
|
|
port: 1420,
|
|
// Fail loudly rather than silently moving ports — tauri.conf.json pins devUrl to 1420.
|
|
strictPort: true,
|
|
},
|
|
test: {
|
|
environment: 'jsdom',
|
|
globals: true,
|
|
setupFiles: [fileURLToPath(new URL('./ui/src/test/setup.ts', import.meta.url))],
|
|
include: ['ui/src/**/*.test.{ts,tsx}'],
|
|
root: fileURLToPath(new URL('.', import.meta.url)),
|
|
// Off unless asked for (`npm run test:coverage`): sonar.yml imports the LCOV, and nothing
|
|
// else reads it, so the plain `npm test` ci-node.yml runs stays as fast as it was.
|
|
coverage: {
|
|
provider: 'v8',
|
|
// `lcovonly`: `lcov` adds an HTML report beside the file Sonar reads.
|
|
reporter: ['text-summary', 'lcovonly'],
|
|
reportsDirectory: 'coverage',
|
|
include: ['ui/src/**/*.{ts,tsx}'],
|
|
// Tests and their harness are not code under test. `generated.ts` is emitted by
|
|
// `cargo run -p xtask -- bindings` and is types alone; `main.tsx` mounts <App/> into the
|
|
// real DOM, which is what App.test.tsx renders instead.
|
|
exclude: [
|
|
'ui/src/**/*.test.{ts,tsx}',
|
|
'ui/src/test/**',
|
|
'ui/src/ipc/generated.ts',
|
|
'ui/src/main.tsx',
|
|
],
|
|
},
|
|
},
|
|
})
|