chore: scope npm publish to dist/ and rebuild before publish#58
Open
alukach wants to merge 3 commits into
Open
chore: scope npm publish to dist/ and rebuild before publish#58alukach wants to merge 3 commits into
alukach wants to merge 3 commits into
Conversation
Add a `files` allowlist limiting the published tarball to `dist/` (plus npm-default README/LICENSE/package.json), and a `prepublishOnly` script that wipes `dist/` and rebuilds. Without these, the tarball included all of `src/` (tests, configs) and any stale outputs left in `dist/`. With them, `npm pack --dry-run` drops from 107 files / 1.1MB unpacked to 26 files / 126KB unpacked. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
With `files: ["dist"]` in package.json, npm uses the allowlist and ignores `.npmignore`. Removing the now-inert file to avoid confusion. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
3 tasks
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
filesallowlist so onlydist/(plus npm-defaultREADME.md,LICENSE,package.json) is included in the published tarball.prepublishOnlyscript that wipesdist/and rebuilds, so we never publish stale build outputs..npmignorebecomes inert oncefilesis set (npm prefers the allowlist). As such, we've removed.npmignorePreviously the published package shipped all of
src/(including tests), top-level configs (eslint.config.js,jest.config.cjs,vite.config.ts, etc.), and any stale files left indist/from prior builds.Impact
npm pack --dry-runbefore:After:
Notes
prepublishOnlyusesrm -rf dist, which is fine for the macOS/Linux dev + CI environment this repo targets.Test plan
npm pack --dry-runshows the expected 26-file tarball