diff options
author | isaacs <i@izs.me> | 2011-02-26 04:25:05 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-02-26 04:25:05 +0300 |
commit | 314c9efc1114a269ac39e263b0bc843e978de62e (patch) | |
tree | bd3382e5bd821e65f4d354ea95b9561a237e476d | |
parent | 7431b8a8999be98f49396efcce1607e4223fbd38 (diff) |
Closes GH-602 Add preupdatedependency-foo lifecycle scripts
-rw-r--r-- | doc/scripts.md | 2 | ||||
-rw-r--r-- | lib/update-dependents.js | 8 | ||||
-rw-r--r-- | man1/scripts.1 | 6 |
3 files changed, 14 insertions, 2 deletions
diff --git a/doc/scripts.md b/doc/scripts.md index 7cf34405e..9815fdcb3 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 1dd0c5642..ed722837c 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 33b12a9ab..683f7575f 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\. . |