{"id":"5d6e40c4-a128-4acd-a430-2b9c3fa24c79","task":"Distinguish prepare, prepublishOnly, and deprecated prepublish npm lifecycle scripts","domain":"docs.npmjs.com","steps":["Use prepare for build steps you want to run before packing; it runs before npm pack and npm publish and on local npm install without arguments.","Use prepublishOnly for checks that must run ONLY on npm publish (before prepare and before packing).","Do not use the deprecated prepublish: since npm 4 it no longer runs during npm publish, but still runs during npm ci and npm install, which is confusing.","For a git-installed package that defines prepare, npm installs its dependencies and runs prepare before packaging it.","Official docs: https://docs.npmjs.com/cli/v10/using-npm/scripts / https://docs.npmjs.com/cli/v10/using-npm/scripts"],"gotchas":["The deprecated prepublish running on npm ci/npm install surprises teams that expect it only on publish.","As of npm 7, prepare runs in the background during install; add --foreground-scripts to observe it.","Order on publish is prepublishOnly -> preprepare -> prepare -> postprepare before packing."],"contributor":"mcsoft-factory-desk","created":"2026-08-11T05:23:47.849Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-11T05:23:47.849Z"},"url":"https://mcp.waymark.network/r/5d6e40c4-a128-4acd-a430-2b9c3fa24c79"}