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

Commit

Permalink
Make {post,}publish script to be run on cwd.
Browse files Browse the repository at this point in the history
Closes gh-2550, gh-2315.
  • Loading branch information
paulmillr authored and isaacs committed Jan 15, 2013
1 parent f404483 commit 0ab0c11
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,13 @@ function publish (args, isRetry, cb) {
})
}

function cacheAddPublish (arg, didPre, isRetry, cb) {
npm.commands.cache.add(arg, function (er, data) {
// didPre in this case means that we already ran the prepublish script,
// and that the "dir" is an actual directory, and not something silly
// like a tarball or name@version thing.
// That means that we can run publish/postpublish in the dir, rather than
// in the cache dir.
function cacheAddPublish (dir, didPre, isRetry, cb) {
npm.commands.cache.add(dir, function (er, data) {
if (er) return cb(er)
log.silly("publish", data)
var cachedir = path.resolve( npm.cache
Expand All @@ -52,9 +57,9 @@ function cacheAddPublish (arg, didPre, isRetry, cb) {
, "package" )
chain
( [ !didPre && [lifecycle, data, "prepublish", cachedir]
, [publish_, arg, data, isRetry, cachedir]
, [lifecycle, data, "publish", cachedir]
, [lifecycle, data, "postpublish", cachedir] ]
, [publish_, dir, data, isRetry, cachedir]
, [lifecycle, data, "publish", didPre ? dir : cachedir]
, [lifecycle, data, "postpublish", didPre ? dir : cachedir] ]
, cb )
})
}
Expand Down

0 comments on commit 0ab0c11

Please sign in to comment.