Skip to content

fix(repo): include all dist subdirectories in published tarballs#68

Merged
anilanar merged 1 commit into
masterfrom
fix-packed-files
May 22, 2026
Merged

fix(repo): include all dist subdirectories in published tarballs#68
anilanar merged 1 commit into
masterfrom
fix-packed-files

Conversation

@anilanar
Copy link
Copy Markdown
Member

⚠️ Critical

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.2 staged tarball contains only dist/cjs/index.js and dist/es/index.js (5 total files). Its CJS entry require()s sibling files (./shared/Result, ./loader, ./legacy-loader, ./v0, ./v1, ./v2, etc.) that aren't in the tarball. Anyone running npm install @userlike/messenger-internal@3.3.2 would hit "Cannot find module" on first import.

@userlike/messenger@2.0.2 has the same problem and is additionally missing dist/browser/index.min.js (the UMD bundle for <script> tag use).

Root cause

yarn pack (yarn 4) does NOT recursively expand directory entries in package.json files — a literal "dist/cjs" matches only the top-level files of that directory, not its subdirectories.

The pre-migration flow shipped via lerna publishnpm publish, which expanded directories recursively, so this worked. Switching to yarn pack broke it silently.

Fix

Both packages now use explicit ** globs in files:

- "files": ["dist/cjs", "dist/es"]
+ "files": ["dist/cjs/**", "dist/es/**"]

(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 *.tgz to .gitignore so 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

  • Discard staged 3.3.2 / 2.0.2 on npmjs.com (do not approve)
  • Merge this PR
  • release-please opens Release PR for 3.3.3 / 2.0.3
  • After publish.yml stages and approval, verify tarballs include all expected files

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.
@anilanar anilanar merged commit aa6fa37 into master May 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant