Publishing a TypeScript package correctly requires configuring a surprising number of things: dual ESM/CJS builds, .d.ts generation, getting the exports field right, type-level tests, changelogs, npm publish. I was managing separate configs for tsup, publint, attw, tsd, and changesets across multiple packages and it was getting unsustainable.
tspub combines all of this into one tool:
- `tspub build` esbuild-based ESM + CJS builds with automatic .d.ts generation. Handles __dirname/__filename shims for CJS, conditional .d.cts/.d.mts for dual packages.
- `tspub check` 70-rule linter for your package before you publish. Catches things like CJS/ESM format mismatches (file contents don't match what exports claims), wrong "types" condition ordering (TypeScript silently resolves `any`), leaked sensitive files, excessive `any` in declarations, and more. Also has `--fix` for safe auto-fixes.
- `tspub test-types` runs type level tests (.test-d.ts files) to verify your public API types are correct.
- `tspub publish` version bump, changelog generation, npm publish, and GitHub release creation in one command.
- `tspub init` scaffolds a correctly configured package from scratch.
The checker also works as a web playground you can check any published npm package without installing: tspub.dev/check/axios
Everything works standalone. You can use just `tspub check` without adopting the build or publish features.
It's still early. I'd appreciate honest feedback especially on the checker (false positives?) and the build output (edge cases I'm missing?).
AnishhGiri•1h ago
tspub combines all of this into one tool:
- `tspub build` esbuild-based ESM + CJS builds with automatic .d.ts generation. Handles __dirname/__filename shims for CJS, conditional .d.cts/.d.mts for dual packages.
- `tspub check` 70-rule linter for your package before you publish. Catches things like CJS/ESM format mismatches (file contents don't match what exports claims), wrong "types" condition ordering (TypeScript silently resolves `any`), leaked sensitive files, excessive `any` in declarations, and more. Also has `--fix` for safe auto-fixes.
- `tspub test-types` runs type level tests (.test-d.ts files) to verify your public API types are correct.
- `tspub publish` version bump, changelog generation, npm publish, and GitHub release creation in one command.
- `tspub init` scaffolds a correctly configured package from scratch.
The checker also works as a web playground you can check any published npm package without installing: tspub.dev/check/axios
Everything works standalone. You can use just `tspub check` without adopting the build or publish features.
It's still early. I'd appreciate honest feedback especially on the checker (false positives?) and the build output (edge cases I'm missing?).
GitHub: https://github.com/tspub/tspub