fix(version): use $npm_config_registry variable to ensure the right registry
BREAKING CHANGE: This breaks the usage of the `semantic-release` CLI outside of npm scripts.
This commit is contained in:
parent
ffbd39e78a
commit
a540c402a9
@ -1,18 +1,17 @@
|
||||
'use strict'
|
||||
|
||||
var exec = require('child_process').exec
|
||||
var unlink = require('fs').unlinkSync
|
||||
|
||||
var efh = require('./error').efh
|
||||
|
||||
module.exports = function (pkg, cb) {
|
||||
if (!pkg.name) return cb(new Error('Package must have a name'))
|
||||
|
||||
exec('npm show ' + pkg.name + ' version', function(err, stdout, stderr) {
|
||||
if (err) unlink('./npm-debug.log')
|
||||
exec('curl -s "' + process.env.npm_config_registry + pkg.name + '"', efh(cb)(function(stdout) {
|
||||
var pkg = JSON.parse(stdout)
|
||||
|
||||
if (err && /is not in the npm registry/m.test(stderr)) return cb(null, null, true)
|
||||
if (pkg.error) return cb(null, null, true)
|
||||
|
||||
if (err) return cb(err)
|
||||
|
||||
cb(null, stdout.trim())
|
||||
})
|
||||
cb(null, pkg['dist-tags'].latest)
|
||||
}))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user