fix(repo): include all dist subdirectories in published tarballs#68
Merged
Conversation
yarn 4's `pack` does not recursively expand directory entries in package.json `files`: a literal `"dist/cjs"` only matches top-level files in dist/cjs, not its subdirectories. Result: every release made via the new flow shipped tarballs containing only `dist/cjs/index.js` and `dist/es/index.js` and missed every other file (loader/, shared/, v0/, v1/, v2/, etc.) plus the UMD browser bundle for @userlike/messenger. The pre-migration flow used `npm publish` via lerna, which DID expand directory entries recursively - so this worked under lerna and broke silently when we switched to `yarn pack`. The 3.3.2 / 2.0.2 tarballs currently staged on npmjs.com are unusable (their dist/cjs/index.js requires sibling files that aren't in the tarball) and must be discarded; this commit ships 3.3.3 / 2.0.3 with the fix. Switch both packages to explicit `**` globs: packages/messenger-internal/package.json: - "dist/cjs", "dist/es" + "dist/cjs/**", "dist/es/**" packages/messenger/package.json: - "dist/cjs", "dist/es", "dist/browser" + "dist/cjs/**", "dist/es/**", "dist/browser/**" Verified locally: yarn pack now emits 64 files for messenger-internal (all subdirs included, no tsbuildinfo leak) and includes dist/browser/index.min.js in messenger.
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.
The 3.3.2 / 2.0.2 tarballs currently staged on npmjs.com are broken and must not be approved. Discard them.
@userlike/messenger-internal@3.3.2staged tarball contains onlydist/cjs/index.jsanddist/es/index.js(5 total files). Its CJS entryrequire()s sibling files (./shared/Result,./loader,./legacy-loader,./v0,./v1,./v2, etc.) that aren't in the tarball. Anyone runningnpm install @userlike/messenger-internal@3.3.2would hit "Cannot find module" on first import.@userlike/messenger@2.0.2has the same problem and is additionally missingdist/browser/index.min.js(the UMD bundle for<script>tag use).Root cause
yarn pack(yarn 4) does NOT recursively expand directory entries inpackage.jsonfiles— a literal"dist/cjs"matches only the top-level files of that directory, not its subdirectories.The pre-migration flow shipped via
lerna publish→npm publish, which expanded directories recursively, so this worked. Switching toyarn packbroke it silently.Fix
Both packages now use explicit
**globs infiles:(plus
"dist/browser/**"for messenger).Verified locally: yarn pack now produces a 64-file tarball for messenger-internal (all subdirs intact, no tsbuildinfo leak) and includes the UMD bundle in messenger.
Also added
*.tgzto.gitignoreso we don't accidentally commit leftover tarballs from local verification.Versions
This is a
fix:commit touching both packages → release-please will bump 3.3.1 → 3.3.3 (skipping the broken 3.3.2) and 2.0.1 → 2.0.3 (skipping the broken 2.0.2).Test plan