Uh oh!
There was an error while loading. Please reload this page.
fix(tsconfig): put scripts/ in a project so editors stop flagging it - #13
Merged
Conversation
`findDocsPath()` resolved five ways, all filesystem — so regenerating src/docs/data.ts meant having a docs.auto.dev checkout and pointing .env at a path on one person's machine. Nobody else could reproduce the output, and the committed result could drift from the docs it claims to mirror with nothing to catch it. Adds DOCS_REF as one more resolution strategy in the same function: DOCS_REF=main pnpm build:docs && pnpm build:docs-data DOCS_REF=feat/no-trials-copy pnpm build:docs It shallow-clones at that ref and returns the path, so everything downstream is untouched — the rest of the script only ever needed a directory. DOCS_REPO overrides the repo if it ever moves. Precedence: a CLI arg still wins, then DOCS_REF, then DOCS_PATH. A ref is a more specific request than a path, so it takes priority over one; an explicit argument beats both. Uses ambient git credentials rather than plumbing a token: a developer's existing auth locally, a token-backed remote in CI. docs.auto.dev is private and this SDK is public, so a workflow using this needs a cross-org read token. That is stated in the code rather than worked around, because there is no way around it. Verified against drivly/docs.auto.dev@feat/no-trials-copy: fetched, converted all 12 product docs, and the regenerated data.ts dropped from 12 "Starter" availability lines to 0 with 12 "**Free**:" in their place — matching drivly/docs.auto.dev#27. data.ts itself is deliberately NOT in this commit. Generating committed content from an unmerged branch pins it to a state that can still change; regenerate from main once #27 lands. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`pnpm build:docs DOCS_REF=main` is the natural thing to type, and it failed with: Product docs not found at: DOCS_REF=main/content/docs/v2/products which reports the symptom rather than the mistake. An env var placed after the command arrives as a positional, and the CLI-arg branch is checked first, so it was taken as a path. Now it says what to do instead: "DOCS_REF=main" looks like an environment variable, not a path. Put it before the command: DOCS_REF=main pnpm build:docs Matches on SCREAMING_CASE followed by `=`, so real paths are unaffected — verified all three forms still behave: bare path, DOCS_REF env var, and the mistyped version. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tsconfig.json included only ["src"], so nothing under scripts/ belonged to any project. An editor opening scripts/build-docs.ts fell back to inferred defaults — no types:["node"], different module resolution — and reported node:fs, process and __dirname as unresolved. Nothing was actually wrong with the file; it just was not part of a project. Split the two configs by their real jobs: - tsconfig.json is the editor and `typecheck` project: src + scripts. - tsconfig.build.json states include:["src"] itself rather than inheriting it, so what tsup emits stays narrow no matter how the base widens. Safe for the build either way — tsup lists its entry points explicitly and all of them are under src/. Typechecking scripts/ for the first time surfaced four real errors, all regex capture groups being string|undefined under noUncheckedIndexedAccess. One is a latent runtime bug rather than a type nit: in the TypeTable parser, `props.match(...)` on a group that failed to capture would have thrown. Both sites now handle the undefined case. test/ is deliberately still excluded. Including it surfaces 31 more of the same class, which is worth doing but is its own change — not something to bundle into a config fix. typecheck 0 errors, build succeeds, 144/144 tests pass, and the generator runs both ways: DOCS_REF=main and the local .env path. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
crisner1978force-pushed
the
fix/tsconfig-covers-scripts-and-tests
branch
from
August 18, 2026 18:23
eb9f1e1 to
6d3c654Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem you hit
tsconfig.jsonincluded only["src"], so nothing underscripts/belonged to any project. An editor openingscripts/build-docs.tsfalls back to inferred defaults — notypes: ["node"], different module resolution — and reportsnode:fs,processand__dirnameas unresolved.Nothing was wrong with the file. It just wasn't part of a project.
Fix
Split the two configs by the job each actually does:
includetsconfig.jsontypecheck["src", "scripts"]tsconfig.build.json["src"]— now stated, not inheritedStating it in the build config matters: it was inheriting
["src"]from the base, so widening the base would silently have widened the build too.Safe either way —
tsup.config.tslists its entry points explicitly and all of them are undersrc/.What typechecking scripts/ found
Four errors, all regex capture groups being
string | undefinedundernoUncheckedIndexedAccess. Three are type nits. One is a latent runtime bug:Both sites now handle the undefined case.
test/ left excluded, on purpose
Including it surfaces 31 more of the same class. Worth doing — but it's its own change, not something to bundle into a config fix. Happy to follow up.
Verification
tsc --noEmit— 0 errorstsupbuild — succeedsDOCS_REF=mainand the local.envpath