tunnel: package hygiene — split build/dist, untrack artifacts, harden publish#66
Open
joelgwebber wants to merge 1 commit into
Open
tunnel: package hygiene — split build/dist, untrack artifacts, harden publish#66joelgwebber wants to merge 1 commit into
joelgwebber wants to merge 1 commit into
Conversation
… publish Cleans up the publish flow so the tarball is always self-contained and local builds can't get into a half-built state. - .gitignore: untrack tunnel/build/ and tunnel/dist/. tsc and rollup outputs are reproducible from sources; carrying them in git produced a 38k-line phantom diff every time `bundle` was run because rollup overwrote the small re-export with the full bundled output at the same path. - rollup.config.mjs: bundle the entire CLI (input build/src/index.js) into a single dist/index.js. Build (tsc → build/) and bundle (rollup → dist/) now write to disjoint trees; no more clobbering. - package.json: - bin/files now point at dist/. - clean wipes both build/ and dist/. - build = clean && tsc (always a fresh build). - bundle = build && rollup. - test = build && node --test (self-bootstrapping). - prepack = bundle (covers both `npm pack` and `npm publish`). - verify = npm pack --dry-run (quick "what would ship?" check). - prepublishOnly removed (covered by prepack). - main.ts: walk up to find package.json instead of hard-coding ../.. since the bundled file at dist/index.js sits one level above package.json and the tsc output at build/src/main.js sits two levels above. - CLAUDE.md: add Tunnel Development section documenting the build/test scripts and the gitignored artifact trees. - Version bumps: tunnel 0.1.17 → 0.1.18, plugin 0.2.8 → 0.2.9. Verified: `npm pack --dry-run` ships exactly two files (dist/index.js + package.json); all 137 tests pass.
chiplay
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
.gitignore— Addedtunnel/build/andtunnel/dist/. Both trees are reproducible from source; carrying them in git produced a ~38k-line phantom diff every timebundlewas run (rollup was overwriting the tsc output in-place).tunnel/rollup.config.mjs— Now bundles the entire CLI frombuild/src/index.js→dist/index.js. The old config only bundledthird_party/index.jsin-place insidebuild/, which was the root cause:buildandbundlewere writing to the same tree and clobbering each other.tunnel/package.jsonbin/filespoint atdist/instead ofbuild/src/build=clean && tsc(always starts fresh)bundle=build && rollup(clean is already inside build; no duplication)test=build && node --test(self-bootstrapping; no stale-build surprises)prepack=bundle— covers bothnpm publishandnpm pack(replacesprepublishOnlywhich only ran on publish)verify=npm pack --dry-runtunnel/src/main.ts— Replaced the hard-coded../../package.jsonpath (only correct frombuild/src/main.js) with afindPackageJson()walk-up. Works from bothbuild/src/main.js(tsc/dev) anddist/index.js(published bundle).CLAUDE.md— Added a Tunnel Development section with the script table and a note thatbuild//dist/are gitignored artifacts.Verified