Skip to content

fix: replace deprecated prepublish script with prepare#604

Merged
MarshallOfSound merged 1 commit into
mainfrom
fix/drop-deprecated-prepublish
Jul 1, 2026
Merged

fix: replace deprecated prepublish script with prepare#604
MarshallOfSound merged 1 commit into
mainfrom
fix/drop-deprecated-prepublish

Conversation

@claude

@claude claude Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Requested by Samuel Attard · Slack thread

Before / After

Before: package.json defined a prepublish script (npm run build). The prepublish lifecycle hook has been deprecated by npm for years, and despite its name it does not run before npm publish — it runs on every npm install. This is confusing and relies on deprecated behavior.

After: The script is renamed to prepare. The prepare hook is the modern, supported lifecycle script that runs both before npm publish/npm pack and on npm install (for git and local installs). This preserves the existing install-time build behavior that prepublish accidentally provided, while moving to a non-deprecated hook.

How

Renamed the single prepublish key to prepare in the scripts block of package.json. The command (npm run build, i.e. tsc) is unchanged. The separate install hook (select-7z-arch.js) is untouched.

prepare was chosen over prepack because prepublish was running on install, so prepack (which only runs before pack/publish) would drop that install-time build. prepare is the safe drop-in that keeps both behaviors.

Fixes #564


Generated by Claude Code

The prepublish npm lifecycle script has been deprecated for years and,
contrary to its name, runs on npm install rather than only before publish.
Rename it to prepare, which runs both before publish/pack and on install,
preserving the existing build-on-install behavior while using a supported
lifecycle hook.

Fixes #564
@MarshallOfSound MarshallOfSound marked this pull request as ready for review June 29, 2026 23:46
@MarshallOfSound MarshallOfSound requested a review from a team as a code owner June 29, 2026 23:46
@MarshallOfSound MarshallOfSound merged commit 5efd6a7 into main Jul 1, 2026
14 checks passed
@MarshallOfSound MarshallOfSound deleted the fix/drop-deprecated-prepublish branch July 1, 2026 05:14
@electron-npm-package-publisher

Copy link
Copy Markdown

🎉 This PR is included in version 5.4.4 🎉

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.

Remove prepublish and install scripts

3 participants