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

Commit

Permalink
Closes GH-602 Add preupdatedependency-foo lifecycle scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Feb 26, 2011
1 parent 7431b8a commit 314c9ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions doc/scripts.md
Expand Up @@ -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:
Expand Down
8 changes: 7 additions & 1 deletion lib/update-dependents.js
Expand Up @@ -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) }
)
})
Expand Down
6 changes: 5 additions & 1 deletion 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
Expand Down Expand Up @@ -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\.
.
Expand Down

0 comments on commit 314c9ef

Please sign in to comment.