tsdown
Library publishing with tsdown
Building + publishing library packages with tsdown.
MUST
- Build/publish packages with
tsdown. Why: standard ecosystem build. - Emit ESM + declaration files. Why: consumers need types.
prepublishOnlybuilds before publish. Why: never ship staledist/.- Export every type used in the public API. Why: DTS generation fails on unexported internal types leaking through re-exports.
- Test-publish a new package name before wiring the repo to it. Why: npm's name-similarity policy REJECTS a short/common single word at
publish(403Package name too similar to existing packages) even thoughnpm viewsays it is free — the block fires only at publish, so a name that passes availability can still fail. A dashless one-word name has the widest collision surface (leat≈lit/lab/tea1,sigil≈sigil_ both blocked); pick a more distinctive real word (leat→headrace,sigil→escutcheon) and confirm with one throwawaypublishbefore renaming the root, member, repo and every consumer dep.
NEVER
- Never bundle a dep the consumer installs itself. Cost: duplicate/version-conflict in consumer tree.