chore(deps): fail with a cause when typescript can't be resolved
The guard resolves typescript from `clients/web`. The realistic way for that to fail is a root install run with INSPECTOR_SKIP_CLIENT_INSTALL=1, which leaves `clients/web/node_modules` empty — and a bare MODULE_NOT_FOUND stack gives no hint that the fix is `npm install` at the root. Throw with that guidance and the original error as `cause`. Deliberately not a silent skip: an unrun guard guards nothing, which is the failure mode the sibling-vouch ring exists to prevent. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HDdo1rNRVQnVRRdsqSrvG3
This commit is contained in:
parent
fcd45037c9
commit
3638185e0f
1 changed files with 14 additions and 1 deletions
|
|
@ -156,7 +156,20 @@ function typescript() {
|
|||
const require_ = createRequire(
|
||||
path.join(repoRoot, "clients", "web", "package.json"),
|
||||
);
|
||||
tsCache = require_("typescript");
|
||||
try {
|
||||
tsCache = require_("typescript");
|
||||
} catch (cause) {
|
||||
// Fail with the cause, not a bare MODULE_NOT_FOUND: the realistic way to
|
||||
// get here is a root install run with INSPECTOR_SKIP_CLIENT_INSTALL=1,
|
||||
// which leaves `clients/web/node_modules` empty. Silently skipping the
|
||||
// check instead would be worse — an unrun guard guards nothing.
|
||||
throw new Error(
|
||||
"verify:dep-lockstep — could not resolve `typescript` from clients/web. " +
|
||||
"Run `npm install` at the repo root (the postinstall cascade installs each client); " +
|
||||
"if you set INSPECTOR_SKIP_CLIENT_INSTALL=1, this guard cannot run.",
|
||||
{ cause },
|
||||
);
|
||||
}
|
||||
}
|
||||
return tsCache;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue