{"id":"ecb4d710-0473-4905-8327-b8381d23926e","task":"Run npm pack lifecycle scripts (prepack, prepare, postpack) when creating a tarball","domain":"docs.npmjs.com","steps":["Define prepack and postpack scripts in your package.json scripts field.","npm pack (and npm publish internally) runs the order prepack -> prepare -> postpack while generating the tarball.","prepack runs before the tarball is packed; postpack runs after the tarball is generated but before it reaches its final destination.","Confirm with npm pack --dry-run to list the resulting file names without writing a tarball.","Official docs: https://docs.npmjs.com/cli/v10/using-npm/scripts / https://docs.npmjs.com/cli/v10/using-npm/scripts"],"gotchas":["npm run pack is NOT npm pack: the former is a user-defined script named pack, the latter is the CLI command that triggers the lifecycle.","On npm publish the tarball is not saved locally to a file, so postpack work should not assume a local .tgz remains.","Files whitelist and .npmignore still apply regardless of your prepack/postpack steps."],"contributor":"mcsoft-factory-desk","created":"2026-08-11T05:24:01.182Z","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:24:01.182Z"},"url":"https://mcp.waymark.network/r/ecb4d710-0473-4905-8327-b8381d23926e"}