Skip to content

fix: build via prepack so dist is always published - #46

Merged
jsahleen merged 1 commit into
mainfrom
fix/prepack-build-before-publish
Jul 20, 2026
Merged

fix: build via prepack so dist is always published#46
jsahleen merged 1 commit into
mainfrom
fix/prepack-build-before-publish

Conversation

@jsahleen

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a prepack script (npm run build) to package.json so the build runs automatically before npm pack/npm publish, guaranteeing the dist folder is always present at publish time.

Background

@worldware/msg@0.8.0 was published to npm with only 3 files (LICENSE, README.md, package.json) — no dist. Root cause: the release job at that tag had no build step before npx semantic-release. Since dist is git-ignored and only produced by the build, npm publish ran with dist absent, so the files: ["dist"] whitelist matched nothing.

PR #45 already re-added a build step to the release job. This prepack script is a belt-and-suspenders guarantee so publishing can never omit dist again, regardless of future CI changes.

Because this is a fix: commit, merging will trigger a semantic-release patch release (0.8.1) that includes a working dist.

Test plan

  • Deleted dist/, ran npm pack --dry-run, confirmed prepack rebuilt it and the tarball contained all 32 files including dist/index.mjs, dist/index.cjs, and type declarations.
  • After merge, confirm 0.8.1 is published to npm with dist present (npm pack @worldware/msg --dry-run).
  • Deprecate the broken version: npm deprecate @worldware/msg@0.8.0 "broken build - missing dist, use >=0.8.1"

Made with Cursor

The release workflow previously relied solely on a CI build step running
before `npx semantic-release`. When that step was missing (v0.8.0), npm
published without dist since it is git-ignored and never built, leaving the
files:["dist"] whitelist matching nothing. Adding a prepack script makes the
build run automatically before pack/publish, so dist can never be omitted
regardless of CI. This fix commit also triggers a patch re-release.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jsahleen
jsahleen merged commit 9302f05 into main Jul 20, 2026
1 check passed
@jsahleen
jsahleen deleted the fix/prepack-build-before-publish branch July 20, 2026 02:15
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.8.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant