commit
782c992755
@ -1,16 +1,16 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
var exec = require('child_process').exec
|
var request = require('request')
|
||||||
|
|
||||||
var efh = require('./error').efh
|
var efh = require('./error').efh
|
||||||
|
|
||||||
module.exports = function (pkg, cb) {
|
module.exports = function (pkg, cb) {
|
||||||
if (!pkg.name) return cb(new Error('Package must have a name'))
|
if (!pkg.name) return cb(new Error('Package must have a name'))
|
||||||
|
|
||||||
exec('curl -s "' + process.env.npm_config_registry + pkg.name + '"', efh(cb)(function(stdout) {
|
request(process.env.npm_config_registry + pkg.name, efh(cb)(function (response, body) {
|
||||||
var pkg = JSON.parse(stdout)
|
var pkg = JSON.parse(body)
|
||||||
|
|
||||||
if (pkg.error) return cb(null, null, true)
|
if (response.statusCode === 404 || pkg.error) return cb(null, null, true)
|
||||||
|
|
||||||
cb(null, pkg['dist-tags'].latest)
|
cb(null, pkg['dist-tags'].latest)
|
||||||
}))
|
}))
|
||||||
|
@ -12,14 +12,16 @@
|
|||||||
"confirm-simple": "^1.0.3",
|
"confirm-simple": "^1.0.3",
|
||||||
"conventional-changelog": "0.0.11",
|
"conventional-changelog": "0.0.11",
|
||||||
"error-first-handler": "^1.0.1",
|
"error-first-handler": "^1.0.1",
|
||||||
|
"git-node": "^0.1.1",
|
||||||
"github": "^0.2.3",
|
"github": "^0.2.3",
|
||||||
"github-url-from-git": "^1.4.0",
|
"github-url-from-git": "^1.4.0",
|
||||||
"minimist": "^1.1.0",
|
"minimist": "^1.1.0",
|
||||||
"parse-github-repo-url": "^1.0.0",
|
"parse-github-repo-url": "^1.0.0",
|
||||||
|
"request": "^2.53.0",
|
||||||
"semver": "^4.2.0"
|
"semver": "^4.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"github-release-fake-server": "^1.1.1",
|
"github-release-fake-server": "^1.2.0",
|
||||||
"lodash.defaults": "^3.0.0",
|
"lodash.defaults": "^3.0.0",
|
||||||
"nano-uid": "^0.2.0",
|
"nano-uid": "^0.2.0",
|
||||||
"nixt": "^0.4.1",
|
"nixt": "^0.4.1",
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
var exec = require('child_process').exec
|
|
||||||
var readFile = require('fs').readFileSync
|
var readFile = require('fs').readFileSync
|
||||||
var url = require('url')
|
var url = require('url')
|
||||||
|
|
||||||
var changelog = require('conventional-changelog')
|
var changelog = require('conventional-changelog')
|
||||||
|
var git = require('git-node')
|
||||||
var GitHubApi = require('github')
|
var GitHubApi = require('github')
|
||||||
var parseSlug = require('parse-github-repo-url')
|
var parseSlug = require('parse-github-repo-url')
|
||||||
var parseUrl = require('github-url-from-git')
|
var parseUrl = require('github-url-from-git')
|
||||||
@ -31,7 +31,7 @@ module.exports = function (options, cb) {
|
|||||||
repository: parseUrl(repository),
|
repository: parseUrl(repository),
|
||||||
file: false
|
file: false
|
||||||
}, efh(cb)(function (log) {
|
}, efh(cb)(function (log) {
|
||||||
exec('git rev-parse HEAD', efh(cb)(function (hash) {
|
git.repo('./.git').loadAs('commit', 'HEAD', efh(cb)(function (commit, hash) {
|
||||||
var ghRepo = parseSlug(repository)
|
var ghRepo = parseSlug(repository)
|
||||||
var release = {
|
var release = {
|
||||||
owner: ghRepo[0],
|
owner: ghRepo[0],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user