Skip to content

chore(build): remove outDir before tsup so no empty dirs survive - #19

Merged
lintdeveloper merged 1 commit into
mainfrom
chore/build-clean-empty-dirs
Aug 4, 2026
Merged

chore(build): remove outDir before tsup so no empty dirs survive#19
lintdeveloper merged 1 commit into
mainfrom
chore/build-clean-empty-dirs

Conversation

@lintdeveloper

Copy link
Copy Markdown
Owner

The one loose end from the #18 review. Build tooling only — no changeset, because consumers receive byte-identical output.

Problem

tsup's clean: true deletes files but leaves empty directories behind:

$ mkdir -p dist/data dist/nested/deep && pnpm build
empty dirs surviving tsup's clean:true:
    dist/data
    dist/nested/deep

That produced a phantom dist/data during the pre-publish integrity check on #18, making a docs-only release look like it had changed dist — the worst possible false alarm while deciding whether patch was the correct bump.

Fix

Remove the outDir outright before tsup. Deterministic, no new dependency:

"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsup"

Verified

Planted dist/data and dist/nested/deep, then rebuilt:

empty dirs after fixed build          0
output vs published 0.5.0 dist        byte-identical ✓
lint ✓   tsc ✓   333 tests ✓   publint + attw ✓
package.json still biome-clean        ✓  (ci:version depends on this)

That last check matters — the release workflow runs biome format --write package.json, so a script edit that left the file unformatted would show up as noise in the next Version Packages PR.

tsup's clean:true deletes files but leaves empty directories behind. That
produced a phantom dist/data during the pre-publish check on #18, which
made a docs-only release look like it had changed dist — exactly the wrong
false alarm to hit while deciding whether 'patch' was the right bump.

Removing the outDir outright is deterministic and needs no new dependency.
Verified by planting dist/data and dist/nested/deep before a build: 0 empty
directories survive, and the output stays byte-identical to the published
0.5.0 dist.

No changeset: consumers receive identical bytes, so this warrants no
version entry.
@lintdeveloper
lintdeveloper merged commit cdd7ca4 into main Aug 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant