build: drop --dts, which emitted declarations nothing can import - #166
build: drop --dts, which emitted declarations nothing can import#166dawsontoth wants to merge 1 commit into
Conversation
This is what blocks the TypeScript 7 upgrade (#145). tsup 8.5.1 inlines its own `rollup-plugin-dts@6.1.1` compiled against `typescript@5.7.3`, and that copy throws on TS 7: TypeError: Cannot read properties of undefined (reading 'useCaseSensitiveFileNames') at node_modules/.pnpm/rollup-plugin-dts@6.1.1_rollup@4.53.2_typescript@5.7.3/... Nothing in our lockfile reaches that vendored copy, so no `overrides` can fix it, and tsup has not published since 2025-11-12 (8.5.1 is the only dist-tag). The crash is confined to the DTS step - the ESM bundle completes before it. And the declarations that step produces are unreachable anyway: package.json has no `types` field, no `typings`, and no `types` condition in `exports` (just `{".": "./dist/index.js"}`), so no TypeScript consumer can resolve them. Nothing in the org imports @harperfast/agent as a library either; it is consumed as a CLI through `bin`. So we have been paying for declaration emit that no consumer could use, and it is the only thing standing between us and TS 7. Verified: build succeeds on both typescript 6.0.3 and 7.0.2, dist still contains cli.js / index.js / schema.graphql, and `node ./dist/cli.js --help` runs. Lint, format, and 345 tests pass. Note this is the minimal unblock. If we would rather keep publishing types, the tsdown migration does that and gets us off unmaintained tooling - the two are alternatives, not a sequence.
There was a problem hiding this comment.
Code Review
This pull request removes the --dts flag from the dev and build scripts in package.json. The reviewer suggests further optimization by removing the unused index.ts entry point from both scripts, since the package is only used as a CLI and no longer needs to compile the library entry point.
| "homepage": "https://github.com/harperfast", | ||
| "scripts": { | ||
| "dev": "tsup index.ts cli.ts --format esm --clean --dts --watch --external puppeteer", | ||
| "dev": "tsup index.ts cli.ts --format esm --clean --watch --external puppeteer", |
There was a problem hiding this comment.
In sync with the build script changes, consider removing index.ts from the dev script entry points to avoid compiling the unused library entry point.
| "dev": "tsup index.ts cli.ts --format esm --clean --watch --external puppeteer", | |
| "dev": "tsup cli.ts --format esm --clean --watch --external puppeteer", |
| "dev": "tsup index.ts cli.ts --format esm --clean --watch --external puppeteer", | ||
| "link": "npm run build && npm link", | ||
| "build": "tsup index.ts cli.ts --format esm --clean --dts --external puppeteer && cp node_modules/harper/schema.graphql dist/", | ||
| "build": "tsup index.ts cli.ts --format esm --clean --external puppeteer && cp node_modules/harper/schema.graphql dist/", |
There was a problem hiding this comment.
Since --dts is being dropped because this package is only consumed as a CLI and not as a library, index.ts and its compiled output dist/index.js are now dead code.
To clean this up and avoid exposing an untyped entry point, consider removing index.ts from the tsup entry points.
Note: If you apply this suggestion, please also remember to:
- Remove the
.export from theexportsfield inpackage.json(lines 33-35). - Delete the unused
index.tsfile.
| "build": "tsup index.ts cli.ts --format esm --clean --external puppeteer && cp node_modules/harper/schema.graphql dist/", | |
| "build": "tsup cli.ts --format esm --clean --external puppeteer && cp node_modules/harper/schema.graphql dist/", |
|
Closing in favor of #167 — the team is going with the tsdown migration, which unblocks TypeScript 7 the same way but also keeps declaration emit and moves off tsup (unpublished since 2025-11-12). No cleanup needed here; the branch is independent of #167. 🤖 Closed via Claude Code |
The blocker
tsup 8.5.1 inlines its own
rollup-plugin-dts@6.1.1, compiled againsttypescript@5.7.3. That copy throws on TS 7:Note the vendored path — nothing in our lockfile reaches that copy, so no
overrideson our side can fix it. tsup hasn't published since 2025-11-12 (8.5.1 is the only dist-tag), so waiting isn't a strategy.The part that makes this easy
The crash is confined to the DTS step. The ESM bundle completes first — you can see
ESM ⚡️ Build successin the log immediately before the stack trace.And the declarations that step produces are unreachable:
No TypeScript consumer can resolve them. Nothing in the org imports
@harperfast/agentas a library either — it's consumed as a CLI throughbin. So we've been paying for declaration emit no one could use, and it is the only thing standing between us and TS 7.Verification
npm run builddist/still containscli.js,index.js,chunk-*.js,schema.graphql;node ./dist/cli.js --helpruns. Lint, format, and 53 files / 345 tests pass.What you give up
The
.d.tsfiles. Concretely: nothing, until someone adds atypescondition toexports— at which point the tsdown branch is the better answer anyway.🤖 Generated with Claude Code