mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-30 01:22:56 +01:00
fix(scripts): harden typecheck gate against tsc launch failures
- PATH fallback reuses runnerArgs so --pretty false is preserved (keeps the line-based error parser intact) - treat empty compiler output (tsc never launched) as a failed check instead of falling through to the "passed" branch and green-lighting CI
This commit is contained in:
@@ -161,11 +161,8 @@ function runTypeCheck(): { ok: boolean } {
|
||||
const tscBin = require.resolve("typescript/bin/tsc");
|
||||
execArgs = { cmd: process.execPath, args: [tscBin, ...runnerArgs] };
|
||||
} catch {
|
||||
// fallback to PATH tsc
|
||||
execArgs = {
|
||||
cmd: "tsc",
|
||||
args: ["-p", "tsconfig.json", "--noEmit", ...extraArgs],
|
||||
};
|
||||
// fallback to PATH tsc (reuse runnerArgs so --pretty false is preserved)
|
||||
execArgs = { cmd: "tsc", args: runnerArgs };
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -190,7 +187,18 @@ function runTypeCheck(): { ok: boolean } {
|
||||
return { ok: true };
|
||||
} catch (error) {
|
||||
const execError = error as { stderr?: string; stdout?: string };
|
||||
const errorOutput = execError.stderr || execError.stdout || "";
|
||||
const errorOutput = execError.stderr || execError.stdout;
|
||||
|
||||
// No compiler output = tsc never ran (e.g. binary missing). Don't let a
|
||||
// launch failure fall through to the "passed" branch and green-light CI.
|
||||
if (!errorOutput) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
log(
|
||||
`❌ ${colors.bold}TypeScript check failed to start${colors.reset} ${colors.gray}${message}${colors.reset}`,
|
||||
colors.red,
|
||||
);
|
||||
return { ok: false };
|
||||
}
|
||||
|
||||
// Filter out jellyseerr utils errors - this is a third-party git submodule
|
||||
// that generates a large volume of known type errors
|
||||
|
||||
Reference in New Issue
Block a user