Skip to content

Use prepack and postpack rather than prepublishOnly and postpublish #1159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
oliverlangan opened this issue Jun 4, 2020 · 4 comments · Fixed by #1196
Closed

Use prepack and postpack rather than prepublishOnly and postpublish #1159

oliverlangan opened this issue Jun 4, 2020 · 4 comments · Fixed by #1196
Labels
build Ideas for or bugs with the build process enhancement need-to-validate question

Comments

@oliverlangan
Copy link

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.

@chriskrycho
Copy link
Member

Thanks for filing this—we'll definitely consider it!

@chriskrycho chriskrycho added build Ideas for or bugs with the build process enhancement need-to-validate question labels Jun 5, 2020
@chriskrycho
Copy link
Member

Cc. @chancancode @dfreeman @jamescdavis @hjdivad

@dfreeman
Copy link
Member

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.

@hjdivad
Copy link
Contributor

hjdivad commented Jun 22, 2020

FWIW we use prepack / postpack at LinkedIn to support custom publishing. It sounds very similar to what @oliverlangan's setup is.

@dfreeman dfreeman linked a pull request Jul 2, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Ideas for or bugs with the build process enhancement need-to-validate question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants