Files
Spoolman/client_v2/package.json
T
Donkie 733dcf9209 client_v2: add vitest and cover migrateV1 and format
client_v2 had no unit tests and no test script; the only spec was the Playwright
a11y audit, which is a separate run.

Adds vitest (`npm test`) configured for src/**/*.test.ts, and starts with the two
files the review called out.

labels/migrateV1.ts is the priority: it rewrites label templates and print presets
users authored in the v1 client, runs unattended at first load, and its output is
what they see afterwards -- a silent mistranslation quietly damages work they
can't recover. Covers the whole path-rewriting table, the bare/wrapped/extra-field
token forms, that a path with no v2 equivalent is left alone rather than mangled,
and the guards that keep a hand-edited preset from yielding a zero-size canvas.

utils/format.ts is second: it formats every weight, length and percentage on
screen. Pins the deliberate rounding rules -- notably that weightAuto floors kg so
a displayed "1.1 kg" never overstates what is on the spool -- and checks
lengthMeters against the known ~335 m for 1 kg of 1.75 mm PLA.

40 tests.
2026-07-28 21:03:48 +02:00

58 lines
1.6 KiB
JSON

{
"name": "spoolman-client-v2",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"strip-empty-locales": "node scripts/strip-empty-locales.mjs",
"predev": "node scripts/strip-empty-locales.mjs",
"dev": "vite dev",
"prebuild": "node scripts/strip-empty-locales.mjs",
"build": "vite build",
"preview": "vite preview",
"test": "vitest run",
"test:watch": "vitest",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"format": "prettier --write .",
"lint": "prettier --check . && eslint .",
"lint:eslint": "eslint .",
"audit:a11y": "playwright test",
"audit:a11y:report": "playwright show-report"
},
"devDependencies": {
"@axe-core/playwright": "^4.12.1",
"@eslint/js": "^9.39.5",
"@inlang/paraglide-js": "^2.18.2",
"@playwright/test": "^1.62.0",
"@sveltejs/adapter-static": "^3.0.6",
"@sveltejs/kit": "^2.8.1",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"@types/qrcode": "^1.5.6",
"eslint": "^9.39.5",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-svelte": "^3.22.0",
"globals": "^16.5.0",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.7",
"svelte": "^5.1.9",
"svelte-check": "^4.0.5",
"typescript": "^5.6.3",
"typescript-eslint": "^8.65.0",
"vite": "^5.4.10",
"vitest": "^2.1.9"
},
"dependencies": {
"@lucide/svelte": "^1.25.0",
"fflate": "^0.8.3",
"konva": "^10.3.0",
"qr-scanner": "^1.4.2",
"qrcode": "^1.5.4",
"svelte-dnd-action": "^0.9.74",
"svelte-konva": "^1.0.1"
},
"allowScripts": {
"esbuild@0.21.5": true
}
}