Skip to content

build(dist): untrack dist/src byproducts and gate the whole dist/ tree - #73

Merged
c-vigo merged 1 commit into
devfrom
chore/70-dist-byproducts
Jul 14, 2026
Merged

c-vigo merged 1 commit into
devfrom
chore/70-dist-byproducts

Conversation

@c-vigo

@c-vigo c-vigo commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Closes #70.

What

dist/ tracked 32 declaration byproducts under dist/src/** alongside the one real artifact, dist/index.js. The .gitignore rule meant to exclude them — dist/__tests__ — never matched their actual path, dist/src/__tests__.

Root cause is broader than the issue assumed: tsconfig.json sets outDir: ./dist with declaration + declarationMap, so both npm run build (tsc) and npm run bundle (ncc) emit them. ncc's own output lists dist/src/commit.d.ts among its assets — a plain just bundle is enough to regenerate all 17 of them.

Changes

  1. git rm -r dist/src — untrack the byproducts.
  2. .gitignore: dead dist/__tests__ rule → dist/* + !dist/index.js, so only the runtime artifact action.yml executes is tracked, and anything the build drops into dist/ is ignored by default.
  3. Both freshness gates (dist-check.yml, release-extension.yml) broadened from dist/index.js to the whole dist/ tree — now possible because the location-dependent .d.ts.map files (which embed absolute file:// paths, and which forced [FEATURE] Guarantee a fresh dist/ bundle on every tagged release (CI dist-check + release-extension verification) #59 to scope narrowly) are gone from the index.

The gates now test git status --porcelain -- dist/ instead of git diff --exit-code. That is strictly stronger: git diff only sees tracked files, so build output that ncc starts emitting and nobody commits would slip through. git status catches both drift and uncommitted artifacts.

Verification

Simulated CI in a fresh clone of this branch (npm ci → npm run bundle):

  • No false positive — ncc regenerates all 17 byproducts under dist/src/, and the gate is clean: git status --porcelain -- dist/ is empty. This is the case that matters, since the gate rebuilds before checking.
  • Still fails on drift — appending to src/retry.ts and rebuilding yields M dist/index.js → gate exits 1.
  • Catches the new case — an artifact emitted but untracked is flagged, where the old git diff gate reported clean.

just precommit (full suite) green.

Refs: #70

dist/ tracked 32 tsc/ncc declaration byproducts under dist/src/ alongside
the one real artifact, dist/index.js. tsconfig.json sets outDir ./dist with
declaration + declarationMap, so both `npm run build` and `npm run bundle`
emit them, while the .gitignore rule meant to exclude them (dist/__tests__)
never matched their actual path (dist/src/__tests__).

Their .d.ts.map files embed absolute file:// source paths, so they were
regenerated differently at every checkout location -- which is what forced
the #59 freshness gate to be scoped to dist/index.js rather than dist/.

Untrack them, replace the dead rule with `dist/*` plus a `!dist/index.js`
re-admit, and broaden both gates to the whole tree. The gates now test with
`git status --porcelain -- dist/` rather than `git diff`, so uncommitted
build output fails them too, not only drift in the committed bundle.

Refs: #70
@c-vigo
c-vigo merged commit 3b288b1 into dev Jul 14, 2026
9 checks passed
@c-vigo
c-vigo deleted the chore/70-dist-byproducts branch July 14, 2026 13:03
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