last-release-apm
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -12,10 +12,12 @@ 'use strict'; | ||
var _request = require('request'); | ||
var _parseGithubUrl = require('parse-github-url'); | ||
var _request2 = _interopRequireDefault(_request); | ||
var _parseGithubUrl2 = _interopRequireDefault(_parseGithubUrl); | ||
var _package = require('./package.js'); | ||
var _github = require('github'); | ||
var _package2 = _interopRequireDefault(_package); | ||
var _github2 = _interopRequireDefault(_github); | ||
var _const = require('./const.js'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -27,9 +29,10 @@ | ||
var GITHUB_API = 'https://api.github.com'; /** | ||
* Dependencies | ||
*/ | ||
/** | ||
* Dependencies | ||
*/ | ||
var headers = { | ||
'User-Agent': 'LastReleaseApm/' + require('../package.json').version | ||
}; | ||
var github = new _github2.default({ | ||
version: '3.0.0', | ||
headers: _const.headers | ||
}); | ||
@@ -40,21 +43,24 @@ /** | ||
function getHead(pack, version, callback) { | ||
var requestSettings = { | ||
url: GITHUB_API + '/repos/' + (0, _package2.default)(pack) + '/tags', | ||
json: true, | ||
headers: headers | ||
}; | ||
function getHead(options, pack, version, callback) { | ||
var _ghParser = (0, _parseGithubUrl2.default)(pack.repository && pack.repository.url || pack.repository); | ||
_request2.default.get(requestSettings, function (error, response) { | ||
var tags = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2]; | ||
var owner = _ghParser.owner; | ||
var name = _ghParser.name; | ||
github.authenticate({ | ||
type: 'oauth', | ||
token: options.githubToken | ||
}); | ||
github.repos.getTags({ user: owner, repo: name }, function (error) { | ||
var tags = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1]; | ||
if (error) return callback(error); | ||
if (response.statusCode === 200) { | ||
var match = tags.filter(function (tag) { | ||
return tag.name === 'v' + version; | ||
}); | ||
if (match.length) { | ||
return callback(null, match[0].commit.sha); | ||
} | ||
var match = tags.filter(function (tag) { | ||
return tag.name === 'v' + version; | ||
}); | ||
if (match.length) { | ||
return callback(null, match[0].commit.sha); | ||
} | ||
@@ -61,0 +67,0 @@ |
@@ -8,2 +8,6 @@ 'use strict'; | ||
var _debug = require('debug'); | ||
var _debug2 = _interopRequireDefault(_debug); | ||
var _version = require('./version.js'); | ||
@@ -20,2 +24,8 @@ | ||
/** | ||
* Dependencies | ||
*/ | ||
var log = (0, _debug2.default)('last-release-apm'); | ||
/** | ||
* Interface | ||
@@ -30,12 +40,17 @@ */ | ||
var pkg = _ref.pkg; | ||
var options = _ref.options; | ||
log(options); | ||
(0, _version2.default)(pkg, function (err1) { | ||
var version = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; | ||
log({ version: version, err1: err1 }); | ||
if (err1) return callback(err1); | ||
if (!version) return callback(null, {}); | ||
(0, _head2.default)(pkg, version, function (err2) { | ||
(0, _head2.default)(options, pkg, version, function (err2) { | ||
var gitHead = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; | ||
log({ gitHead: gitHead, err2: err2 }); | ||
if (err2) return callback(err2); | ||
@@ -42,0 +57,0 @@ |
@@ -16,18 +16,7 @@ 'use strict'; | ||
var _const = require('./const.js'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
* Privates | ||
*/ | ||
/** | ||
* Dependencies | ||
*/ | ||
var ATOM_REGISTRY = 'https://atom.io'; | ||
var headers = { | ||
'User-Agent': 'LastReleaseApm/' + require('../package.json').version | ||
}; | ||
/** | ||
* Interface | ||
@@ -38,5 +27,5 @@ */ | ||
var requestSettings = { | ||
url: ATOM_REGISTRY + '/api/packages/' + pack.name, | ||
url: _const.ATOM_REGISTRY + '/api/packages/' + pack.name, | ||
json: true, | ||
headers: headers | ||
headers: _const.headers | ||
}; | ||
@@ -61,3 +50,6 @@ | ||
}); | ||
} | ||
} /** | ||
* Dependencies | ||
*/ | ||
module.exports = exports['default']; |
{ | ||
"name": "last-release-apm", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "determine the version of the last release via the apm registry", | ||
@@ -34,18 +34,21 @@ "author": "Arnaud Dezandee <dezandee.arnaud@gmail.com> (https://github.com/Adezandee)", | ||
"@semantic-release/error": "^1.0.0", | ||
"request": "^2.67.0" | ||
"debug": "^2.2.0", | ||
"github": "^0.2.4", | ||
"parse-github-url": "^0.3.0", | ||
"request": "^2.69.0" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.4.0", | ||
"babel-eslint": "^5.0.0-beta6", | ||
"babel-cli": "^6.5.1", | ||
"babel-eslint": "^5.0.0", | ||
"babel-plugin-add-module-exports": "^0.1.2", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-register": "^6.3.13", | ||
"chai": "^3.4.1", | ||
"babel-preset-es2015": "^6.5.0", | ||
"babel-register": "^6.5.2", | ||
"chai": "^3.5.0", | ||
"coveralls": "^2.11.6", | ||
"cz-conventional-changelog": "^1.1.5", | ||
"eslint": "^1.10.3", | ||
"eslint-config-airbnb": "^3.1.0", | ||
"eslint-config-airbnb": "^5.0.0", | ||
"isparta": "^4.0.0", | ||
"mocha": "^2.3.4", | ||
"nock": "^5.2.1", | ||
"mocha": "^2.4.5", | ||
"nock": "^7.2.1", | ||
"semantic-release": "^4.3.5" | ||
@@ -52,0 +55,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13611
5
141
+ Addeddebug@^2.2.0
+ Addedgithub@^0.2.4
+ Addedparse-github-url@^0.3.0
+ Addeddebug@2.6.9(transitive)
+ Addedgithub@0.2.4(transitive)
+ Addedmime@1.6.0(transitive)
+ Addedms@2.0.0(transitive)
+ Addedparse-github-url@0.3.2(transitive)
Updatedrequest@^2.69.0