Skip to content

Commit ac030bd

Browse files
stewartjarodclaude
andcommitted
fix: make typecheck:infra runnable from a normal checkout
The script called a bare `tsc`, but the root package has no typescript dependency, so it failed with "tsc: command not found" unless a global tsc happened to be installed. Add typescript (catalog) to the root devDependencies and run it through scripts/typecheck-infra.sh. That script also checks for the generated .sst/platform and infra/.sst/platform type directories first. When either is missing, tsc reports hundreds of "Cannot find name 'aws'" errors that hide the cause; it now stops and prints the bootstrap commands from docs/agents/local-dev.md instead. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GxJAQRVHiCL6JA2xUf2nRg
1 parent 14223c2 commit ac030bd

4 files changed

Lines changed: 38 additions & 4 deletions

File tree

‎docs/agents/local-dev.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ defaults (`http://localhost:3001` / `:3000`), which portless leaves unserved.
1717
## `pnpm check:all` in a fresh checkout
1818

1919
`pnpm install` is **not** enough for `check:all` in a tree nobody has built in — a fresh
20-
clone, a CI runner, or an isolated git worktree. Its `typecheck:infra` step is a bare
21-
`tsc` over `sst.config.ts` and `infra/selfhost.config.ts`, and both files open with
20+
clone, a CI runner, or an isolated git worktree. Its `typecheck:infra` step
21+
(`scripts/typecheck-infra.sh`) runs the root `tsc` over `sst.config.ts` and
22+
`infra/selfhost.config.ts`, and both files open with
2223
`/// <reference path="./.sst/platform/config.d.ts" />`. That file is *generated*, never
23-
built, so no amount of `turbo run build` produces it. Bootstrap it:
24+
built, so no amount of `turbo run build` produces it. The script checks for both
25+
directories first and prints these commands when one is missing. Bootstrap it:
2426

2527
```bash
2628
pnpm install

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"test:e2e": "pnpm --filter @wraps/e2e test:e2e",
1818
"test:coverage": "turbo run test:coverage --filter=@wraps.dev/cli",
1919
"typecheck": "turbo run typecheck",
20-
"typecheck:infra": "tsc --noEmit --strict --skipLibCheck --target ES2022 --module ESNext --moduleResolution bundler --resolveJsonModule --esModuleInterop --allowSyntheticDefaultImports sst.config.ts infra/selfhost.config.ts",
20+
"typecheck:infra": "bash scripts/typecheck-infra.sh",
2121
"check": "pnpm dlx ultracite@6.3.2 check",
2222
"check:errors": "pnpm dlx ultracite@6.3.2 check --diagnostic-level=error",
2323
"test:architecture": "vitest run --config vitest.config.ts",
@@ -76,6 +76,7 @@
7676
"react-email": "5.2.8",
7777
"sst": "4.2.4",
7878
"tsx": "^4.23.1",
79+
"typescript": "catalog:",
7980
"turbo": "^2.10.7",
8081
"ultracite": "6.3.2",
8182
"vitest": "catalog:"

‎pnpm-lock.yaml‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/typecheck-infra.sh‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
# typecheck:infra — tsc over the two SST configs, which sit outside the pnpm
3+
# workspace so `turbo run typecheck` never visits them.
4+
#
5+
# Both files open with `/// <reference path="./.sst/platform/config.d.ts" />`,
6+
# and that file is generated by `sst install`, not built. Without it tsc reports
7+
# hundreds of "Cannot find name 'aws'" errors that hide the real cause, so check
8+
# for it first and say how to create it. Bootstrap steps: docs/agents/local-dev.md.
9+
set -euo pipefail
10+
11+
cd "$(dirname "$0")/.."
12+
13+
missing=()
14+
[[ -f .sst/platform/config.d.ts ]] || missing+=(".sst/platform")
15+
[[ -f infra/.sst/platform/config.d.ts ]] || missing+=("infra/.sst/platform")
16+
17+
if (( ${#missing[@]} > 0 )); then
18+
echo "typecheck:infra needs generated SST platform types that are missing: ${missing[*]}" >&2
19+
echo "Generate them (details in docs/agents/local-dev.md):" >&2
20+
echo " node_modules/.bin/sst install" >&2
21+
echo " (cd infra && ../node_modules/.bin/sst install --config selfhost.config.ts --stage production)" >&2
22+
exit 1
23+
fi
24+
25+
exec node_modules/.bin/tsc --noEmit --strict --skipLibCheck \
26+
--target ES2022 --module ESNext --moduleResolution bundler \
27+
--resolveJsonModule --esModuleInterop --allowSyntheticDefaultImports \
28+
sst.config.ts infra/selfhost.config.ts

0 commit comments

Comments
 (0)