fix(cli): automatically run in debug mode locally
BREAKING CHANGE: The `--no-ci` flag is gone. If you want to run `semantic-release` locally now you have to explicitly run `semantic-release pre --debug=false` && `semantic-release post --debug=false`
This commit is contained in:
parent
d94c6b76d3
commit
e0fc4840de
@ -14,7 +14,9 @@ var argv = minimist(process.argv.slice(2), {
|
||||
t: 'token',
|
||||
g: 'github-url'
|
||||
},
|
||||
booleans: ['debug'],
|
||||
default: {
|
||||
debug: !process.env.CI,
|
||||
token: process.env.GH_TOKEN || process.env.TOKEN || process.env.GITHUB_TOKEN,
|
||||
'github-url': process.env.GH_URL
|
||||
}
|
||||
@ -31,7 +33,8 @@ if (~argv._.indexOf('pre')) {
|
||||
// in this case we abort the command and do nothing.
|
||||
if (isAbbrev(npmArgv, 'install')) process.exit(0)
|
||||
|
||||
return confirmCI(function () {
|
||||
if (argv.debug) console.log('This is a dry run')
|
||||
|
||||
console.log('Determining new version')
|
||||
|
||||
var publish = false
|
||||
@ -46,31 +49,21 @@ if (~argv._.indexOf('pre')) {
|
||||
console.log('Publishing v' + result)
|
||||
if (!publish) process.exit(0)
|
||||
|
||||
if (argv.debug) process.exit(1)
|
||||
|
||||
require('../src/restart')(efh(function () {
|
||||
process.exit(1)
|
||||
}))
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
if (~argv._.indexOf('post')) {
|
||||
return confirmCI(function () {
|
||||
require('../src/post')(argv, efh(function () {
|
||||
// see src/restart.js
|
||||
if (npmArgv['semantic-release-rerun']) {
|
||||
console.log('Everything is alright :) npm will now print an error message that you can safely ignore.')
|
||||
}
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
function confirmCI (cb) {
|
||||
if (process.env.CI || argv.ci === false) return cb(null, true)
|
||||
|
||||
confirm('Not running in a CI enviroment. Are you sure you want to run this hook?', function (ok) {
|
||||
if (!ok) process.exit(1)
|
||||
cb(null, ok)
|
||||
})
|
||||
}
|
||||
|
||||
function isAbbrev (argv, command) {
|
||||
|
@ -9,7 +9,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"abbrev": "^1.0.5",
|
||||
"confirm-simple": "^1.0.3",
|
||||
"conventional-changelog": "0.0.11",
|
||||
"error-first-handler": "^1.0.1",
|
||||
"git-node": "^0.1.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user