Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19fd15c1dc | ||
|
|
16cf9aee9b |
+14
-7
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict'
|
||||
|
||||
var abbrev = require('abbrev')
|
||||
var confirm = require('confirm-simple')
|
||||
var minimist = require('minimist')
|
||||
|
||||
var argv = require('minimist')(process.argv.slice(2), {
|
||||
var argv = minimist(process.argv.slice(2), {
|
||||
alias: {
|
||||
d: 'debug',
|
||||
dry: 'debug',
|
||||
@@ -14,20 +16,21 @@ var argv = require('minimist')(process.argv.slice(2), {
|
||||
}
|
||||
})
|
||||
|
||||
var npmArgv = process.env.npm_config_argv
|
||||
npmArgv = npmArgv ? JSON.parse(npmArgv).cooked : []
|
||||
var npmArgv = process.env.npm_config_argv ?
|
||||
minimist(JSON.parse(process.env.npm_config_argv).cooked) :
|
||||
{_: []}
|
||||
|
||||
if (~argv._.indexOf('pre')) {
|
||||
var publish = false
|
||||
|
||||
// see src/restart.js
|
||||
if (~npmArgv.indexOf('--semantic-release-rerun')) process.exit(0)
|
||||
if (npmArgv['semantic-release-rerun']) process.exit(0)
|
||||
// the `prepublish` hook is also executed when the package is installed
|
||||
// in this case we abort the command and do nothing.
|
||||
if (~npmArgv.indexOf('install')) process.exit(0)
|
||||
if (isAbbrev(npmArgv, 'install')) process.exit(0)
|
||||
|
||||
return confirmCI(function () {
|
||||
if (~npmArgv.indexOf('publish')) publish = true
|
||||
if (isAbbrev(npmArgv, 'publish')) publish = true
|
||||
|
||||
console.log('Determining new version')
|
||||
|
||||
@@ -64,7 +67,7 @@ if (~argv._.indexOf('post')) {
|
||||
}
|
||||
|
||||
// see src/restart.js
|
||||
if (~npmArgv.indexOf('--semantic-release-rerun')) {
|
||||
if (npmArgv['semantic-release-rerun']) {
|
||||
console.log('Everything is alright :) npm will now print an error message that you can safely ignore.')
|
||||
}
|
||||
})
|
||||
@@ -79,3 +82,7 @@ function confirmCI (cb) {
|
||||
cb(null, ok)
|
||||
})
|
||||
}
|
||||
|
||||
function isAbbrev (argv, command) {
|
||||
return argv._.some(Object.prototype.hasOwnProperty.bind(abbrev(command)))
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"url": "https://github.com/boennemann/semantic-release/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"abbrev": "^1.0.5",
|
||||
"confirm-simple": "^1.0.3",
|
||||
"conventional-changelog": "0.0.11",
|
||||
"github": "^0.2.3",
|
||||
|
||||
Reference in New Issue
Block a user