Skip to content

Commit

Permalink
fix: populating --new-version interferes with some commands, like git…
Browse files Browse the repository at this point in the history
…, better that someone pull this value from package.json
  • Loading branch information
Benjamin Coe committed Jun 6, 2017
1 parent 10f3e03 commit 37a2647
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/lifecycles/bump.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function Bump (args, pkg) {

if (args.skip.bump) return Promise.resolve()
var newVersion = pkg.version
return runLifecycleScript(args, 'prebump', null)
return runLifecycleScript(args, 'prebump')
.then((stdout) => {
if (stdout && stdout.trim().length) args.releaseAs = stdout.trim()
return bumpVersion(args.releaseAs)
Expand All @@ -32,7 +32,7 @@ function Bump (args, pkg) {
}
})
.then(() => {
return runLifecycleScript(args, 'postbump', newVersion, args)
return runLifecycleScript(args, 'postbump')
})
.then(() => {
return newVersion
Expand Down
4 changes: 2 additions & 2 deletions lib/lifecycles/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ const writeFile = require('../write-file')

module.exports = function (args, newVersion) {
if (args.skip.changelog) return Promise.resolve()
return runLifecycleScript(args, 'prechangelog', newVersion, args)
return runLifecycleScript(args, 'prechangelog')
.then(() => {
return outputChangelog(args, newVersion)
})
.then(() => {
return runLifecycleScript(args, 'postchangelog', newVersion, args)
return runLifecycleScript(args, 'postchangelog')
})
}

Expand Down
4 changes: 2 additions & 2 deletions lib/lifecycles/commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ const runLifecycleScript = require('../run-lifecycle-script')

module.exports = function (args, newVersion) {
if (args.skip.commit) return Promise.resolve()
return runLifecycleScript(args, 'precommit', newVersion, args)
return runLifecycleScript(args, 'precommit')
.then((message) => {
if (message && message.length) args.message = message
return execCommit(args, newVersion)
})
.then(() => {
return runLifecycleScript(args, 'postcommit', newVersion, args)
return runLifecycleScript(args, 'postcommit')
})
}

Expand Down
4 changes: 2 additions & 2 deletions lib/lifecycles/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ const runLifecycleScript = require('../run-lifecycle-script')

module.exports = function (newVersion, pkgPrivate, args) {
if (args.skip.tag) return Promise.resolve()
return runLifecycleScript(args, 'pretag', newVersion, args)
return runLifecycleScript(args, 'pretag')
.then(() => {
return execTag(newVersion, pkgPrivate, args)
})
.then(() => {
return runLifecycleScript(args, 'posttag', newVersion, args)
return runLifecycleScript(args, 'posttag')
})
}

Expand Down
3 changes: 1 addition & 2 deletions lib/run-lifecycle-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ const checkpoint = require('./checkpoint')
const figures = require('figures')
const runExec = require('./run-exec')

module.exports = function (args, hookName, newVersion) {
module.exports = function (args, hookName) {
const scripts = args.scripts
if (!scripts || !scripts[hookName]) return Promise.resolve()
var command = scripts[hookName]
if (newVersion) command += ' --new-version="' + newVersion + '"'
checkpoint(args, 'Running lifecycle script "%s"', [hookName])
checkpoint(args, '- execute command: "%s"', [command], chalk.blue(figures.info))
return runExec(args, command)
Expand Down

0 comments on commit 37a2647

Please sign in to comment.