fix(package): stop shipping src/ tree in published tarball#204
Open
sroussey wants to merge 1 commit into
Open
Conversation
…k safeguard `c7e3c4a` intended `files: ["dist"]` (its final commit message says so verbatim) but the landed diff kept "src" from an earlier revision. `13f9d06` then flipped `private: false`, so `bun publish` on 0.0.11 shipped the whole 77 MB src/ tree — 267 test files, ~15 MB of committed EDGAR HTML mock_data, and the golden-truth SPAC corpus. - Drop "src" from files in package.json (dist-only, matching intent-of-record). - Add scripts/checkPackedContents.ts + `prepack-check` script that fails on *.test.ts, mock_data/ paths, or unpacked size > 5 MB. - Wire prepack-check into `release` before `bunset` so a regression blocks the version bump. - CLAUDE.md note explaining why `src` must not be added back. use-source dev-flow is unaffected — bun link reads source from the workspace on disk; the tarball is not involved. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01413eP4Awsvn2HSXqr4MFYh
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.
Summary
c7e3c4aintendedfiles: ["dist"](verbatim per its final commit message) but the landed diff kept"src"from an earlier revision.13f9d06then flipped"private": false, sobun publishon 0.0.11 shipped the whole 77 MBsrc/tree — 267*.test.ts, ~15 MB of committed EDGAR HTML mock_data, and the golden-truth SPAC corpus.Changes
package.json— remove"src"fromfiles; addprepack-checkscript; wire intoreleasebeforebunset.scripts/checkPackedContents.ts(new) — inspectsbun pm pack --dry-runoutput, fails on*.test.ts,mock_data/, or unpacked size > 5 MB.CLAUDE.md— one paragraph documenting whysrcmust not be re-added.Why not keep
srcwith exclusion sub-globs?The
use-sourcedev-flow (scripts/bunsrc.ts) is workspace-local: it edits this workspace'spackage.jsonviabun pm pkg set exports=..., andbun link'd consumers read live source from disk. No consumer needssrc/*.tsinside the tarball; keepingsrcwith excludes preserves a large tarball surface and invites future fixture-secret leakage.Verification
bun pm pack --dry-run— no.test.ts/mock_data/entries; unpacked size 2.91 MB (was 75.38 MB).bun pm pack— tarball 1609 files, 544 KB gzipped / 2.91 MB unpacked.bun ./dist/sec.js --helpworks.import("./dist/index.js")resolves the library barrel (45 exports).bun run use-source/bun run use-distflip works unchanged.bun run prepack-checkexits 0 on clean tarball, non-zero whensrcis re-added (927 forbidden files, 74.65 MB flagged).Note on the check script:
bun pm pack --dry-runin bun 1.3.11 has no--jsonmode (it silently ignores the flag and emits plain text). The script triesbun pm pack --jsonfirst, then falls back tonpm pack --dry-run --json(which returns well-defined JSON withfiles[].path+unpackedSize), then finally to parsing bun's plain-text listing — so the safeguard fires with or without npm on PATH.Follow-ups (not in this PR)
npm deprecate @workglow-dev/sec@0.0.11 "ships 77MB of test fixtures; use 0.0.12+"(do NOT unpublish — breaks downstream lockfiles).src/eval/embarcUnitTermsReference.ts,src/eval/realSections.ts, andsrc/task/fixtures/fetchS1Fixtures.tsresolvemock_datapaths viaimport.meta.dir, which after bundling intodist/index.jscollapses to thedist/folder — those subcommands were already broken for installed users regardless ofsrcshipping. Separate fix warranted.Generated by Claude Code