As an app or addon publisher, I want my type definitions created in prepack so that I can use a non-standard publishing mechanism.
According to the npm scripts documentation, prepublishOnly only runs on npm publish (and presumably yarn publish), but our CI/publish environment uses neither.
I believe it would be more flexible to use prepack instead of prepublishOnly; and in the interest of making it symmetric, I suggest we also use postpack instead of postpublish.
Thanks for filing this鈥攚e'll definitely consider it!
Cc. @chancancode @dfreeman @jamescdavis @hjdivad
IIRC we originally went with prepublishOnly/postpublish because Yarn didn't trigger prepack and postpack during publish, so that was our only practical lifecycle hook that would work consistently between Yarn and npm.
While Yarn 1 still plays a bit fast and loose compared to Yarn 2 and npm in terms of when it executes lifecycle scripts, it _does_ look like prepack and postpack trigger correctly during publish in recent Yarn 1.x releases, so this change seems reasonable to me.
For both npm and Yarn 2, I believe this would also make installation from git remotes work properly without requiring any special effort from addon authors, but that's one area where Yarn 1 is still divergent from the other managers in the ecosystem.
FWIW we use prepack / postpack at LinkedIn to support custom publishing. It sounds very similar to what @oliverlangan's setup is.
Most helpful comment
Cc. @chancancode @dfreeman @jamescdavis @hjdivad