diff --git a/doc/scripts.md b/doc/scripts.md index 7cf34405e18..9815fdcb303 100644 --- a/doc/scripts.md +++ b/doc/scripts.md @@ -30,6 +30,8 @@ following scripts: Run BEFORE the package dependencies are pointed to the new version. * updatedependencies, postupdatedependencies: Run AFTER the package dependencies are pointed to the new version. +* (pre,post,)updatedependency-foo: + Run (before,after) the "foo" dependency is modified. * pretest, test, posttest: Run by the `npm test` command. * prestop, stop, poststop: diff --git a/lib/update-dependents.js b/lib/update-dependents.js index 1dd0c564228..ed722837c92 100644 --- a/lib/update-dependents.js +++ b/lib/update-dependents.js @@ -148,8 +148,14 @@ function updateDepToNew (depName, depVer, pkg, other, cb) { , cb ) chain - ( [ removeDependencyLinks, data, pkg, other ] + ( [ lifecycle, data, "preupdatedependency" ] + , [ lifecycle, data, "preupdatedependency-"+depName ] + , [ removeDependencyLinks, data, pkg, other ] , [ createDependencyLinks, data, pkg ] + , [ lifecycle, data, "updatedependency-"+depName ] + , [ lifecycle, data, "postupdatedependency-"+depName ] + , [ lifecycle, data, "updatedependency" ] + , [ lifecycle, data, "postupdatedependency" ] , function (er) { cb(er, pkg.name+"@"+other) } ) }) diff --git a/man1/scripts.1 b/man1/scripts.1 index 33b12a9ab79..683f7575fc5 100644 --- a/man1/scripts.1 +++ b/man1/scripts.1 @@ -1,7 +1,7 @@ .\" Generated with Ronnjs/v0.1 .\" http://github.com/kapouer/ronnjs/ . -.TH "NPM\-SCRIPTS" "1" "January 2011" "" "" +.TH "NPM\-SCRIPTS" "1" "February 2011" "" "" . .SH "NAME" \fBnpm-scripts\fR \-\- How npm handles the "scripts" field @@ -59,6 +59,10 @@ updatedependencies, postupdatedependencies: Run AFTER the package dependencies are pointed to the new version\. . .IP "\(bu" 4 +(pre,post,)updatedependency\-foo: +Run (before,after) the "foo" dependency is modified\. +. +.IP "\(bu" 4 pretest, test, posttest: Run by the \fBnpm test\fR command\. .