Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Closes GH-602 Add preupdatedependency-foo lifecycle scripts

  • Loading branch information...
commit 314c9efc1114a269ac39e263b0bc843e978de62e 1 parent 7431b8a
@isaacs isaacs authored
Showing with 14 additions and 2 deletions.
  1. +2 −0  doc/scripts.md
  2. +7 −1 lib/update-dependents.js
  3. +5 −1 man1/scripts.1
View
2  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:
View
8 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) }
)
})
View
6 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\.
.
Please sign in to comment.
Something went wrong with that request. Please try again.