fix(build): reduce published package size by fixing files field#123
fix(build): reduce published package size by fixing files field#123Kyzgor wants to merge 1 commit into
Conversation
The existing `files` field in package.json contained broken negation patterns (`!**/*.spec.*`, `!**/*.json`) that caused the whitelist to not function correctly, and referenced a nonexistent `CHANGELOG.md`. Fix the `files` field to properly scope exclusions within the `build/` directory, removing test artifacts from the published package while keeping the whitelist behavior intact. Fixes permitio#90
|
The |
|
Thanks for this, @Kyzgor — and for the clear before/after We're closing it because it's superseded by #127 (PER-15197), which fixes the same |
What kind of change does this PR introduce?
Bug fix (build / packaging). It removes compiled test fixtures that are still shipped in the
published
permitionpm package.What is the current behavior? (link: Published package contains many unnecessary file #90)
The
filesallowlist inpackage.jsonalready scopes the published package tobuild/(so thedev tree —
src/,docs/,.github/, etc. — is not shipped), and!**/*.spec.*alreadyexcludes compiled spec files. However, the non-spec test fixtures compiled into
build/tests/—fixtures.js,fixtures.mjs,fixtures.d.ts, and their source maps — are not.spec.*files, so they slip past the negation and end up in the tarball. The field also lists aCHANGELOG.mdthat does not exist in the repo (npm warns on it) and uses an overly broad!**/*.jsonnegation that is incorrect for an allowlist.What is the new behavior (if this is a feature change)?
The
filesfield is scoped to exclude the compiled test tree and drop the dead/over-broad entries:Verified with
npm pack --dry-run(Node 20). The published tarball no longer contains anybuild/tests/or*.spec.*artifacts, while the entire public API surface is preserved:main)Removed (exactly 5 files):
build/tests/fixtures.{d.ts,js,js.map,mjs,mjs.map}. Still present andverified:
build/index.js,build/index.mjs,build/index.d.ts,LICENSE,README.md,package.json. No non-testbuild/output is dropped.Other information:
Reproducible before/after evidence
What's NOT in this PR: no dependency changes, no
tsconfig/tsup/build-script changes, noCHANGELOG.mdaddition or release-tooling wiring. A cleaner long-term follow-up — scopingtsup'sentrysosrc/tests/**never compiles intobuild/at all — is tracked separately.The
security/snyk (permit)check ERRORs on this PR; it is an external/integration issue on forkPRs (this PR changes no dependencies) and is unrelated to the change. A maintainer re-run/waiver
would clear it.
Fixes Published package contains many unnecessary file #90