From 59606ae6343d04054d4a989c4324e0b49332530d Mon Sep 17 00:00:00 2001 From: Eric Sampson Date: Sun, 7 Dec 2025 08:04:01 -0800 Subject: [PATCH 1/2] feat: add --fail-on-warnings flag to check command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add support for the --fail-on-warnings flag that mirrors the behavior of the underlying svelte-check CLI. When this flag is passed to the check command: - If running in daemon mode: exit with code 1 when hasWarnings is true - If running svelte-check directly (fallback): pass --fail-on-warnings to svelte-check This allows CI pipelines to fail on warnings, matching the behavior users expect from svelte-check --fail-on-warnings. Bumps version to 0.1.0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- bin/svelte-check-daemon.js | 19 ++++++++++++------- package.json | 2 +- src/client.ts | 6 +++++- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/bin/svelte-check-daemon.js b/bin/svelte-check-daemon.js index 96c23b8..f6fb369 100644 --- a/bin/svelte-check-daemon.js +++ b/bin/svelte-check-daemon.js @@ -13,6 +13,7 @@ const command = args[0]; function parseArgs() { let workspacePath = process.cwd(); let tsconfigPath = undefined; + let failOnWarnings = false; for (let i = 0; i < args.length; i++) { if (args[i] === '--workspace' && args[i + 1]) { @@ -21,10 +22,12 @@ function parseArgs() { } else if (args[i] === '--tsconfig' && args[i + 1]) { tsconfigPath = args[i + 1]; i++; + } else if (args[i] === '--fail-on-warnings') { + failOnWarnings = true; } } - return { workspacePath, tsconfigPath }; + return { workspacePath, tsconfigPath, failOnWarnings }; } async function runDaemon() { @@ -34,7 +37,7 @@ async function runDaemon() { } async function runCheck() { - const { workspacePath, tsconfigPath } = parseArgs(); + const { workspacePath, tsconfigPath, failOnWarnings } = parseArgs(); // In CI, always run svelte-kit sync first to ensure generated types are up to date if (process.env.CI || !isDaemonRunning(workspacePath)) { @@ -52,7 +55,7 @@ async function runCheck() { console.error('\x1b[33m Start the daemon with: svelte-check-daemon start\x1b[0m\n'); } - const { success, output } = runSvelteCheckDirectly(workspacePath, tsconfigPath); + const { success, output } = runSvelteCheckDirectly(workspacePath, tsconfigPath, failOnWarnings); console.log(output); process.exit(success ? 0 : 1); } @@ -84,7 +87,8 @@ async function runCheck() { } console.log(status.output); - process.exit(status.hasErrors ? 1 : 0); + const shouldFail = status.hasErrors || (failOnWarnings && status.hasWarnings); + process.exit(shouldFail ? 1 : 0); } function stopDaemon() { @@ -139,9 +143,10 @@ Commands: status Show daemon status Options: - --workspace Path to workspace (default: current directory) - --tsconfig Path to tsconfig.json - --help Show this help message + --workspace Path to workspace (default: current directory) + --tsconfig Path to tsconfig.json + --fail-on-warnings Exit with error code when there are warnings (check command only) + --help Show this help message `); } diff --git a/package.json b/package.json index 1a99049..b906273 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@ampcode/svelte-check-daemon", "publisher": "ampcode", "description": "A daemon for svelte-check that caches results for faster type checking", - "version": "0.0.4", + "version": "0.1.0", "packageManager": "pnpm@10.24.0", "license": "Apache-2.0", "type": "module", diff --git a/src/client.ts b/src/client.ts index 8d4aaf3..e29bd06 100644 --- a/src/client.ts +++ b/src/client.ts @@ -57,12 +57,16 @@ export function isDaemonRunning(workspacePath: string): boolean { export function runSvelteCheckDirectly( workspacePath: string, - tsconfigPath?: string + tsconfigPath?: string, + failOnWarnings?: boolean ): { success: boolean; output: string } { const args = ['--output', 'human']; if (tsconfigPath) { args.push('--tsconfig', tsconfigPath); } + if (failOnWarnings) { + args.push('--fail-on-warnings'); + } const result = spawnSync('svelte-check', args, { cwd: workspacePath, From bb2cee85891112e19cf67a0ef487a04ec399d487 Mon Sep 17 00:00:00 2001 From: Eric Sampson Date: Fri, 26 Dec 2025 11:12:19 -0800 Subject: [PATCH 2/2] chore: add prepare script for github ref installs --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b906273..731cb21 100644 --- a/package.json +++ b/package.json @@ -32,13 +32,15 @@ ], "scripts": { "build": "tsc", - "prepublishOnly": "pnpm build" + "prepublishOnly": "pnpm build", + "prepare": "pnpm build" }, "peerDependencies": { "svelte-check": ">=4.0.0" }, "devDependencies": { "@types/node": "^20.0.0", - "typescript": "^5.0.0" + "typescript": "^5.0.0", + "pnpm": "^10.0.0" } }