Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

postupdate / preupdate hooks #12237

Closed
leegee opened this issue Apr 6, 2016 · 6 comments
Closed

postupdate / preupdate hooks #12237

leegee opened this issue Apr 6, 2016 · 6 comments

Comments

@leegee
Copy link

leegee commented Apr 6, 2016

npm install has hooks either side of it, but npm update has not.

I often use npm postinstall to run bower install, I would like to have npm run bower update after npm update

@othiym23 othiym23 changed the title Feature Request: postupdate / preupdate hooks postupdate / preupdate hooks Apr 6, 2016
@othiym23
Copy link
Contributor

othiym23 commented Apr 8, 2016

Bower's update and npm's update do different things; under the hood npm's update calls npm outdated followed by npm install with the results list of outdated packages. It doesn't make much sense to distinguish between install and update for lifecycle purposes. If you want a way to couple the updating of your npm and bower dependencies, a short script, cmd, or Makefile stanza is the most flexible way to get the exact behavior you want. Because this isn't something the CLI team is going to add to npm, I'm going to close this feature request. Thanks for your time, and I hope you find this explanation useful.

@PMLavigne
Copy link

Sorry for resurrecting this old ticket, but is there still no plan to add pre/post update hooks? I believe I have a more compelling use - running flow-typed update. The flow-typed files are very tightly coupled to the versions of the packages installed (especially the auto-generated stubs) and being able to have them automatically generated whenever npm update is run would be incredibly helpful.

@Gpx
Copy link

Gpx commented Nov 18, 2017

@PMLavigne I'm trying to do the exact same thing. Did you find a solution meanwhile?

@alexkrolick
Copy link

alexkrolick commented Nov 19, 2017

I think this would also be useful for printing out Release Notes and things like that, but maybe only in --dev mode (installing a package from its directory rather than as a dependency).

@PMLavigne
Copy link

@Gpx unfortunately no, I wound up just doing a much less elegant wrapper script that runs both separately, and using that instead. Still would massively prefer if this functionality were present natively, maybe with a big fat warning if there's concern it could be used incorrectly?

@gmcdev
Copy link

gmcdev commented Feb 16, 2018

I'm looking for a way to make a backup of the current package-lock.json ... on a "preupdate" sort of a basis. Since the lifecycle hook idea is out, what is the alternative? Recommendations?

Another challenge I notice is that package-lock.json does not get written until after the "postinstall" hook finishes. What event to use to post-/pre-process package-lock.json??

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants