github-release-notes
Advanced tools
Comparing version 0.12.1 to 0.12.2
@@ -90,2 +90,5 @@ 'use strict'; | ||
}, { | ||
description: 'Ignore the tags including an Array of strings', | ||
code: 'gren release --tags=all --ignore-tags-with="-rc","-alpha","-beta"' | ||
}, { | ||
name: 'Work with milestones', | ||
@@ -92,0 +95,0 @@ description: 'Create release notes for a tag using the belonging to a milestone that matches the name of the tag. e.g. If the tag is 4.0.0, `gren` is going to match the milestone _"Release 4.0.0"_.', |
@@ -41,3 +41,3 @@ 'use strict'; | ||
}, { | ||
short: '-au', | ||
short: '-a', | ||
name: 'api-url', | ||
@@ -61,8 +61,8 @@ valueType: '<url>', | ||
name: 'data-source', | ||
valueType: '<issues|commits|milestones>', | ||
valueType: '<issues|commits|milestones|prs>', | ||
description: 'The informations you want to use to build release notes. [issues]', | ||
action: /^(issues|commits|milestones)$/i, | ||
action: /^(issues|commits|milestones|prs)$/i, | ||
defaultValue: 'issues' | ||
}, { | ||
short: '-im', | ||
short: '-N', | ||
name: 'include-messages', | ||
@@ -74,2 +74,18 @@ valueType: '<merge|commits|all>', | ||
}, { | ||
short: '-i', | ||
name: 'ignore-tags-with', | ||
valueType: '<string1>,<string2>', | ||
description: 'Ignore tags that contain one of the specified strings.', | ||
action: function action(value) { | ||
return value.split(','); | ||
} | ||
}, { | ||
short: '-C', | ||
name: 'ignore-commits-with', | ||
valueType: '<string1>,<string2>', | ||
description: 'Ignore commits that contain one of the specified strings.', | ||
action: function action(value) { | ||
return value.split(','); | ||
} | ||
}, { | ||
short: '-p', | ||
@@ -83,4 +99,3 @@ name: 'prefix', | ||
valueType: '<label>', | ||
description: 'Group the issues using the labels as group headings. You can set custom headings for groups of labels from a configuration file.', | ||
action: /^(label)$/i | ||
description: 'Group the issues using the labels as group headings. You can set custom headings for groups of labels from a configuration file.' | ||
}, { | ||
@@ -103,3 +118,3 @@ short: '-L', | ||
}, { | ||
short: '-mm', | ||
short: '-M', | ||
name: 'milestone-match', | ||
@@ -113,2 +128,6 @@ valueType: '<prefix>', | ||
description: 'Add to the release bodies only the issues that have a milestone' | ||
}, { | ||
short: '-q', | ||
name: 'quiet', | ||
description: 'Run command without console logs.' | ||
}], | ||
@@ -120,3 +139,3 @@ releaseOptions: [{ | ||
}, { | ||
short: '-pr', | ||
short: '-e', | ||
name: 'prerelease', | ||
@@ -123,0 +142,0 @@ description: 'Set the release as a prerelease.' |
@@ -22,2 +22,2 @@ #!/usr/bin/env node | ||
_commander2.default.version(_package.version).description('gren (\uD83E\uDD16 ) ' + _package.description).usage('<command> [options]').command('release', 'Release into chunk').alias('r').command('changelog', 'Write a motherfucking changelog').alias('c').command('examples', 'Show few examples of stuff that you can do <cmd>').parse(argvWithVersion(process.argv)); | ||
_commander2.default.version(_package.version).description('gren (\uD83E\uDD16 ) ' + _package.description).usage('<command> [options]').command('init', 'initialise the module').command('release', 'Release into chunk').alias('r').command('changelog', 'Write a motherfucking changelog').alias('c').command('examples', 'Show few examples of stuff that you can do <cmd>').parse(argvWithVersion(process.argv)); |
# Changelog | ||
## v0.12.1 (14/10/2017) | ||
*No changelog for this release.* | ||
--- | ||
## v0.12.0 (14/10/2017) | ||
#### Bug Fixes: | ||
- [#99](https://github.com/github-tools/github-release-notes/issues/99) Use Babel transform runtime | ||
- [#95](https://github.com/github-tools/github-release-notes/issues/95) Extend limit option to include pagination | ||
--- | ||
## v0.11.0 (13/10/2017) | ||
#### Framework Enhancements: | ||
- [#69](https://github.com/github-tools/github-release-notes/issues/69) Remove the releases limit | ||
#### Bug Fixes: | ||
- [#69](https://github.com/github-tools/github-release-notes/issues/69) Remove the releases limit | ||
--- | ||
## v0.10.1 (12/10/2017) | ||
#### Bug Fixes: | ||
- [#90](https://github.com/github-tools/github-release-notes/issues/90) Fix the token option | ||
--- | ||
## v0.10.0 (08/10/2017) | ||
@@ -8,3 +42,3 @@ | ||
- [#81](https://github.com/github-tools/github-release-notes/issues/81) Swap Grunt with Gulp | ||
- [#80](https://github.com/github-tools/github-release-notes/issues/80) `gren --help` quietly does shit | ||
- [#80](https://github.com/github-tools/github-release-notes/issues/80) `gren --help` quietly does stuff | ||
- [#78](https://github.com/github-tools/github-release-notes/issues/78) README doesn't explain what gren does | ||
@@ -11,0 +45,0 @@ - [#72](https://github.com/github-tools/github-release-notes/issues/72) Expanded options for commit template variables |
'use strict'; | ||
var _stringify = require('babel-runtime/core-js/json/stringify'); | ||
var _stringify2 = _interopRequireDefault(_stringify); | ||
var _typeof2 = require('babel-runtime/helpers/typeof'); | ||
@@ -15,2 +19,8 @@ | ||
var fs = require('fs'); | ||
var ora = require('ora'); | ||
var YAML = require('json2yaml'); | ||
var _require = require('js-beautify'), | ||
beautify = _require.js_beautify; | ||
require('require-yaml'); | ||
@@ -43,3 +53,7 @@ | ||
*/ // istanbul ignore next | ||
function printTask(name) { | ||
function printTask(isQuiet, name) { | ||
if (isQuiet) { | ||
return; | ||
} | ||
process.stdout.write(chalk.blue('\n\uD83E\uDD16 - ' + name + ':\n===================================\n')); | ||
@@ -59,17 +73,14 @@ } | ||
function task(gren, taskName) { | ||
var time = process.hrtime(); | ||
process.stdout.write('\n' + chalk.green(taskName) + ' : .'); | ||
if (gren.options.quiet) { | ||
gren.tasks[taskName] = {}; | ||
gren.tasks[taskName] = setInterval(function () { | ||
process.stdout.write('.'); | ||
}, 100); | ||
return noop; | ||
} | ||
var spinner = ora(taskName); | ||
gren.tasks[taskName] = spinner; | ||
spinner.start(); | ||
return function (message) { | ||
var diff = process.hrtime(time); | ||
var seconds = ((diff[0] * 1e9 + diff[1]) * 1e-9).toFixed(2); | ||
process.stdout.write(message || '' + chalk.yellow(' (' + seconds + ' secs)\n')); | ||
clearInterval(gren.tasks[taskName]); | ||
gren.tasks[taskName] = seconds; | ||
spinner.succeed(message); | ||
}; | ||
@@ -92,3 +103,3 @@ } | ||
(0, _keys2.default)(gren.tasks).forEach(function (taskName) { | ||
clearInterval(gren.tasks[taskName]); | ||
gren.tasks[taskName].stop(); | ||
}); | ||
@@ -206,3 +217,3 @@ | ||
function getConfigFromFile(path) { | ||
return ['.grenrc.yml', '.grenrc.json', '.grenrc.yaml', '.grenrc.js', '.grenrc'].reduce(function (carry, filename) { | ||
return getFileTypes().reduce(function (carry, filename) { | ||
return carry || requireConfig(path + '/' + filename); | ||
@@ -213,2 +224,44 @@ }, false) || {}; | ||
/** | ||
* Return the extension of a filename | ||
* | ||
* @param {string} filename | ||
* | ||
* @return {string} | ||
*/ | ||
function getFileExtension(filename) { | ||
return filename.slice((Math.max(0, filename.lastIndexOf('.')) || Infinity) + 1); | ||
} | ||
/** | ||
* Create the content for a configuratio file, based on extension and data | ||
* | ||
* @param {string} path | ||
* @param {Object} data | ||
* | ||
* @return {string} File content | ||
*/ // istanbul ignore next | ||
function writeConfigToFile(path, data) { | ||
var extension = getFileExtension(getFileNameFromPath(path)); | ||
var dataType = { | ||
yml: function yml(content) { | ||
return YAML.stringify(content); | ||
}, | ||
yaml: function yaml(content) { | ||
return YAML.stringify(content); | ||
}, | ||
json: function json(content) { | ||
return beautify((0, _stringify2.default)(content)); | ||
}, | ||
none: function none(content) { | ||
return beautify((0, _stringify2.default)(content)); | ||
}, | ||
js: function js(content) { | ||
return beautify('module.exports = ' + (0, _stringify2.default)(content)); | ||
} | ||
}; | ||
return dataType[extension](data); | ||
} | ||
/** | ||
* Get the filename from a path | ||
@@ -223,19 +276,68 @@ * | ||
*/ | ||
function getFileNameFromPath(path) { | ||
return path.split('\\').pop().split('/').pop(); | ||
function getFileNameFromPath() { | ||
var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; | ||
return path.replace(/^.*[\\/]/, ''); | ||
} | ||
/** | ||
* Get the file types for the configuration | ||
* | ||
* @since 0.13.0 | ||
* | ||
* @return {Array} | ||
*/ | ||
function getFileTypes() { | ||
return ['.grenrc.yml', '.grenrc.json', '.grenrc.yaml', '.grenrc.js', '.grenrc']; | ||
} | ||
/** | ||
* Remove all the configuration files | ||
* | ||
* @since 0.13.0 | ||
* | ||
* @param {Boolean} confirm Necessary to force the function. | ||
*/ | ||
function cleanConfig(confirm) { | ||
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd(); | ||
if (confirm !== true) { | ||
return; | ||
} | ||
getFileTypes().forEach(function (fileName) { | ||
var file = path + '/' + fileName; | ||
if (!fs.existsSync(file)) { | ||
return false; | ||
} | ||
fs.unlinkSync(file); | ||
return file; | ||
}); | ||
} | ||
/** | ||
* Just a noop function | ||
*/ | ||
function noop() {} | ||
// Allow nodeunit to work. Has to be fixed. | ||
module.exports = { | ||
sortObject: sortObject, | ||
printTask: printTask, | ||
task: task, | ||
cleanConfig: cleanConfig, | ||
clearTasks: clearTasks, | ||
convertStringToArray: convertStringToArray, | ||
dashToCamelCase: dashToCamelCase, | ||
formatDate: formatDate, | ||
getConfigFromFile: getConfigFromFile, | ||
getFileExtension: getFileExtension, | ||
getFileNameFromPath: getFileNameFromPath, | ||
getFileTypes: getFileTypes, | ||
isInRange: isInRange, | ||
convertStringToArray: convertStringToArray, | ||
formatDate: formatDate, | ||
noop: noop, | ||
printTask: printTask, | ||
requireConfig: requireConfig, | ||
getConfigFromFile: getConfigFromFile, | ||
noop: function noop() {} | ||
sortObject: sortObject, | ||
task: task, | ||
writeConfigToFile: writeConfigToFile | ||
}; |
820
dist/Gren.js
@@ -31,2 +31,6 @@ 'use strict'; | ||
var _regenerator = require('babel-runtime/regenerator'); | ||
var _regenerator2 = _interopRequireDefault(_regenerator); | ||
var _promise = require('babel-runtime/core-js/promise'); | ||
@@ -36,2 +40,6 @@ | ||
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator'); | ||
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2); | ||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
@@ -83,5 +91,7 @@ | ||
generate: false, | ||
quiet: false, | ||
override: false, | ||
ignoreLabels: false, | ||
ignoreIssuesWith: false, | ||
ignoreCommitsWith: false, | ||
groupBy: false, | ||
@@ -111,3 +121,5 @@ milestoneMatch: 'Release {{tag_name}}' | ||
ignoreLabels = _options.ignoreLabels, | ||
ignoreIssuesWith = _options.ignoreIssuesWith; | ||
ignoreIssuesWith = _options.ignoreIssuesWith, | ||
ignoreCommitsWith = _options.ignoreCommitsWith, | ||
ignoreTagsWith = _options.ignoreTagsWith; | ||
@@ -118,2 +130,4 @@ | ||
this.options.ignoreIssuesWith = _utils2.default.convertStringToArray(ignoreIssuesWith); | ||
this.options.ignoreCommitsWith = _utils2.default.convertStringToArray(ignoreCommitsWith); | ||
this.options.ignoreTagsWith = _utils2.default.convertStringToArray(ignoreTagsWith); | ||
this.options.limit = this.options.tags.indexOf('all') >= 0 ? MAX_TAGS_LIMIT : TAGS_LIMIT; | ||
@@ -145,16 +159,41 @@ | ||
key: 'release', | ||
value: function release() { | ||
var _this = this; | ||
value: function () { | ||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() { | ||
var _this = this; | ||
_utils2.default.printTask('Generate release notes'); | ||
var blocks; | ||
return _regenerator2.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_utils2.default.printTask(this.options.quiet, 'Generate release notes'); | ||
return this._hasNetwork().then(this._getReleaseBlocks.bind(this)).then(function (blocks) { | ||
console.log(''); | ||
_context.next = 3; | ||
return this._hasNetwork(); | ||
return blocks.reduce(function (carry, block) { | ||
return carry.then(_this._prepareRelease.bind(_this, block)); | ||
}, _promise2.default.resolve()); | ||
}); | ||
} | ||
case 3: | ||
_context.next = 5; | ||
return this._getReleaseBlocks(); | ||
case 5: | ||
blocks = _context.sent; | ||
return _context.abrupt('return', blocks.reduce(function (carry, block) { | ||
return carry.then(_this._prepareRelease.bind(_this, block)); | ||
}, _promise2.default.resolve())); | ||
case 7: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, this); | ||
})); | ||
function release() { | ||
return _ref.apply(this, arguments); | ||
} | ||
return release; | ||
}() | ||
/** | ||
@@ -171,24 +210,65 @@ * Generate changelog file based on the release notes or generate new one | ||
key: 'changelog', | ||
value: function changelog() { | ||
var _this2 = this; | ||
value: function () { | ||
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2() { | ||
var releases; | ||
return _regenerator2.default.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
_utils2.default.printTask(this.options.quiet, 'Generate changelog file'); | ||
_utils2.default.printTask('Generate changelog file'); | ||
_context2.next = 3; | ||
return this._hasNetwork(); | ||
return this._hasNetwork().then(this._checkChangelogFile.bind(this)).then(function () { | ||
if (_this2.options.generate) { | ||
return _this2._getReleaseBlocks(); | ||
} | ||
case 3: | ||
this._checkChangelogFile(); | ||
return _this2._getListReleases(); | ||
}).then(function (releases) { | ||
if (releases.length === 0) { | ||
throw _chalk2.default.red('There are no releases, use --generate to create release notes, or run the release command.'); | ||
} | ||
if (!this.options.generate) { | ||
_context2.next = 10; | ||
break; | ||
} | ||
return _promise2.default.resolve(releases); | ||
}).then(function (releases) { | ||
_this2._createChangelog(_this2._templateReleases(releases)); | ||
}); | ||
} | ||
_context2.next = 7; | ||
return this._getReleaseBlocks(); | ||
case 7: | ||
_context2.t0 = _context2.sent; | ||
_context2.next = 13; | ||
break; | ||
case 10: | ||
_context2.next = 12; | ||
return this._getListReleases(); | ||
case 12: | ||
_context2.t0 = _context2.sent; | ||
case 13: | ||
releases = _context2.t0; | ||
if (!(releases.length === 0)) { | ||
_context2.next = 16; | ||
break; | ||
} | ||
throw _chalk2.default.red('There are no releases, use --generate to create release notes, or run the release command.'); | ||
case 16: | ||
return _context2.abrupt('return', this._createChangelog(this._templateReleases(releases))); | ||
case 17: | ||
case 'end': | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee2, this); | ||
})); | ||
function changelog() { | ||
return _ref2.apply(this, arguments); | ||
} | ||
return changelog; | ||
}() | ||
/** | ||
@@ -200,3 +280,3 @@ * Check if the changelog file exists | ||
* | ||
* @return {Promise} | ||
* @return {string} | ||
*/ | ||
@@ -210,6 +290,6 @@ | ||
if (_fs2.default.existsSync(filePath) && !this.options.override) { | ||
return _promise2.default.reject(_chalk2.default.black(_chalk2.default.bgYellow('Looks like there is already a changelog, to override it use --override'))); | ||
throw _chalk2.default.black(_chalk2.default.bgYellow('Looks like there is already a changelog, to override it use --override')); | ||
} | ||
return _promise2.default.resolve(); | ||
return filePath; | ||
} | ||
@@ -229,2 +309,3 @@ | ||
value: function _createChangelog(body) { | ||
var loaded = _utils2.default.task(this, 'Creating ' + this.options.changelogFilename); | ||
var filePath = process.cwd() + '/' + this.options.changelogFilename; | ||
@@ -234,3 +315,3 @@ | ||
console.log(_chalk2.default.green('\nChangelog created in ' + filePath)); | ||
loaded(_chalk2.default.green('\nChangelog created in ' + filePath)); | ||
} | ||
@@ -261,17 +342,38 @@ | ||
key: '_editRelease', | ||
value: function _editRelease(releaseId, releaseOptions) { | ||
var loaded = _utils2.default.task(this, 'Updating latest release'); | ||
value: function () { | ||
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(releaseId, releaseOptions) { | ||
var loaded, _ref4, release; | ||
return this.repo.updateRelease(releaseId, releaseOptions).then(function (_ref) { | ||
var release = _ref.data; | ||
return _regenerator2.default.wrap(function _callee3$(_context3) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
loaded = _utils2.default.task(this, 'Updating latest release'); | ||
_context3.next = 3; | ||
return this.repo.updateRelease(releaseId, releaseOptions); | ||
loaded(); | ||
case 3: | ||
_ref4 = _context3.sent; | ||
release = _ref4.data; | ||
console.log(_chalk2.default.green('\n' + release.name + ' has been successfully updated!')); | ||
console.log(_chalk2.default.blue('See the results here: ' + release.html_url)); | ||
return release; | ||
}); | ||
} | ||
loaded(_chalk2.default.green(release.name + ' has been successfully updated!') + _chalk2.default.blue('\nSee the results here: ' + release.html_url)); | ||
return _context3.abrupt('return', release); | ||
case 7: | ||
case 'end': | ||
return _context3.stop(); | ||
} | ||
} | ||
}, _callee3, this); | ||
})); | ||
function _editRelease(_x2, _x3) { | ||
return _ref3.apply(this, arguments); | ||
} | ||
return _editRelease; | ||
}() | ||
/** | ||
@@ -298,17 +400,38 @@ * Create a release from a given tag (in the options) | ||
key: '_createRelease', | ||
value: function _createRelease(releaseOptions) { | ||
var loaded = _utils2.default.task(this, 'Preparing the release'); | ||
value: function () { | ||
var _ref5 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(releaseOptions) { | ||
var loaded, _ref6, release; | ||
return this.repo.createRelease(releaseOptions).then(function (_ref2) { | ||
var release = _ref2.data; | ||
return _regenerator2.default.wrap(function _callee4$(_context4) { | ||
while (1) { | ||
switch (_context4.prev = _context4.next) { | ||
case 0: | ||
loaded = _utils2.default.task(this, 'Preparing the release'); | ||
_context4.next = 3; | ||
return this.repo.createRelease(releaseOptions); | ||
loaded(); | ||
case 3: | ||
_ref6 = _context4.sent; | ||
release = _ref6.data; | ||
console.log(_chalk2.default.green('\n' + release.name + ' has been successfully created!')); | ||
console.log(_chalk2.default.blue('See the results here: ' + release.html_url)); | ||
return release; | ||
}); | ||
} | ||
loaded(_chalk2.default.green('\n' + release.name + ' has been successfully created!') + _chalk2.default.blue('See the results here: ' + release.html_url)); | ||
return _context4.abrupt('return', release); | ||
case 7: | ||
case 'end': | ||
return _context4.stop(); | ||
} | ||
} | ||
}, _callee4, this); | ||
})); | ||
function _createRelease(_x4) { | ||
return _ref5.apply(this, arguments); | ||
} | ||
return _createRelease; | ||
}() | ||
/** | ||
@@ -378,4 +501,4 @@ * Creates the options to make the release | ||
return allTags.filter(function (_ref3, index) { | ||
var name = _ref3.name; | ||
return allTags.filter(function (_ref7, index) { | ||
var name = _ref7.name; | ||
@@ -420,42 +543,79 @@ var isSelectedTag = selectedTags.includes(name); | ||
key: '_getLastTags', | ||
value: function _getLastTags(releases) { | ||
var _this3 = this; | ||
value: function () { | ||
var _ref8 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(releases) { | ||
var _this2 = this; | ||
var page = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; | ||
var limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.options.limit; | ||
var page = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; | ||
var limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.options.limit; | ||
return this._listTags({ | ||
per_page: limit, | ||
page: page | ||
}).then(function (_ref4) { | ||
var link = _ref4.headers.link, | ||
tags = _ref4.data; | ||
var _ref9, link, tags, filteredTags, totalPages; | ||
if (!tags.length) { | ||
throw _chalk2.default.red('Looks like you have no tags! Tag a commit first and then run gren again'); | ||
} | ||
return _regenerator2.default.wrap(function _callee5$(_context5) { | ||
while (1) { | ||
switch (_context5.prev = _context5.next) { | ||
case 0: | ||
_context5.next = 2; | ||
return this._listTags({ | ||
per_page: limit, | ||
page: page | ||
}); | ||
var filteredTags = (_this3._getSelectedTags(tags) || [tags[0], tags[1]]).filter(Boolean).map(function (tag) { | ||
var tagRelease = releases ? releases.filter(function (release) { | ||
return release.tag_name === tag.name; | ||
})[0] : false; | ||
var releaseId = tagRelease ? tagRelease.id : null; | ||
case 2: | ||
_ref9 = _context5.sent; | ||
link = _ref9.headers.link; | ||
tags = _ref9.data; | ||
return { | ||
tag: tag, | ||
releaseId: releaseId | ||
}; | ||
}); | ||
var totalPages = _this3._getLastPage(link); | ||
if (tags.length) { | ||
_context5.next = 7; | ||
break; | ||
} | ||
if (_this3.options.tags.indexOf('all') >= 0 && totalPages && +page < totalPages) { | ||
return _this3._getLastTags(releases, page + 1).then(function (moreTags) { | ||
return moreTags.concat(filteredTags); | ||
}); | ||
} | ||
throw _chalk2.default.red('Looks like you have no tags! Tag a commit first and then run gren again'); | ||
return filteredTags; | ||
}); | ||
} | ||
case 7: | ||
filteredTags = (this._getSelectedTags(tags) || [tags[0], tags[1]]).filter(Boolean).filter(function (_ref10) { | ||
var name = _ref10.name; | ||
return _this2.options.ignoreTagsWith.every(function (ignoreTag) { | ||
return !name.match(ignoreTag); | ||
}); | ||
}).map(function (tag) { | ||
var tagRelease = releases ? releases.filter(function (release) { | ||
return release.tag_name === tag.name; | ||
})[0] : false; | ||
var releaseId = tagRelease ? tagRelease.id : null; | ||
return { | ||
tag: tag, | ||
releaseId: releaseId | ||
}; | ||
}); | ||
totalPages = this._getLastPage(link); | ||
if (!(this.options.tags.indexOf('all') >= 0 && totalPages && +page < totalPages)) { | ||
_context5.next = 11; | ||
break; | ||
} | ||
return _context5.abrupt('return', this._getLastTags(releases, page + 1).then(function (moreTags) { | ||
return moreTags.concat(filteredTags); | ||
})); | ||
case 11: | ||
return _context5.abrupt('return', filteredTags); | ||
case 12: | ||
case 'end': | ||
return _context5.stop(); | ||
} | ||
} | ||
}, _callee5, this); | ||
})); | ||
function _getLastTags(_x7) { | ||
return _ref8.apply(this, arguments); | ||
} | ||
return _getLastTags; | ||
}() | ||
/** | ||
@@ -475,14 +635,36 @@ * Get the dates of the last two tags | ||
value: function _getTagDates(tags) { | ||
var _this4 = this; | ||
var _this3 = this; | ||
return tags.map(function (tag) { | ||
return _this4.repo.getCommit(tag.tag.commit.sha).then(function (_ref5) { | ||
var committer = _ref5.data.committer; | ||
return { | ||
id: tag.releaseId, | ||
name: tag.tag.name, | ||
date: committer.date | ||
}; | ||
}); | ||
}); | ||
return tags.map(function () { | ||
var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee6(tag) { | ||
var _ref12, committer; | ||
return _regenerator2.default.wrap(function _callee6$(_context6) { | ||
while (1) { | ||
switch (_context6.prev = _context6.next) { | ||
case 0: | ||
_context6.next = 2; | ||
return _this3.repo.getCommit(tag.tag.commit.sha); | ||
case 2: | ||
_ref12 = _context6.sent; | ||
committer = _ref12.data.committer; | ||
return _context6.abrupt('return', { | ||
id: tag.releaseId, | ||
name: tag.tag.name, | ||
date: committer.date | ||
}); | ||
case 5: | ||
case 'end': | ||
return _context6.stop(); | ||
} | ||
} | ||
}, _callee6, _this3); | ||
})); | ||
return function (_x8) { | ||
return _ref11.apply(this, arguments); | ||
}; | ||
}()); | ||
} | ||
@@ -535,33 +717,56 @@ | ||
key: '_getListReleases', | ||
value: function _getListReleases() { | ||
var _this5 = this; | ||
value: function () { | ||
var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7() { | ||
var page = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; | ||
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.limit; | ||
var page = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; | ||
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.limit; | ||
var loaded, _ref14, link, releases, totalPages; | ||
var loaded = _utils2.default.task(this, 'Getting the list of releases'); | ||
return _regenerator2.default.wrap(function _callee7$(_context7) { | ||
while (1) { | ||
switch (_context7.prev = _context7.next) { | ||
case 0: | ||
loaded = _utils2.default.task(this, 'Getting the list of releases'); | ||
_context7.next = 3; | ||
return this._listReleases({ | ||
per_page: limit, | ||
page: page | ||
}); | ||
return this._listReleases({ | ||
per_page: limit, | ||
page: page | ||
}).then(function (_ref6) { | ||
var link = _ref6.headers.link, | ||
releases = _ref6.data; | ||
case 3: | ||
_ref14 = _context7.sent; | ||
link = _ref14.headers.link; | ||
releases = _ref14.data; | ||
totalPages = this._getLastPage(link); | ||
loaded(); | ||
if (!(this.options.tags.indexOf('all') >= 0 && totalPages && +page < totalPages)) { | ||
_context7.next = 9; | ||
break; | ||
} | ||
var totalPages = _this5._getLastPage(link); | ||
return _context7.abrupt('return', this._getListReleases(page + 1).then(function (moreReleases) { | ||
return moreReleases.concat(releases); | ||
})); | ||
if (_this5.options.tags.indexOf('all') >= 0 && totalPages && +page < totalPages) { | ||
return _this5._getListReleases(page + 1).then(function (moreReleases) { | ||
return moreReleases.concat(releases); | ||
}); | ||
} | ||
case 9: | ||
process.stdout.write(releases.length + ' releases found\n'); | ||
loaded('Releases found: ' + releases.length); | ||
return releases; | ||
}); | ||
} | ||
return _context7.abrupt('return', releases); | ||
case 11: | ||
case 'end': | ||
return _context7.stop(); | ||
} | ||
} | ||
}, _callee7, this); | ||
})); | ||
function _getListReleases() { | ||
return _ref13.apply(this, arguments); | ||
} | ||
return _getListReleases; | ||
}() | ||
/** | ||
@@ -607,8 +812,8 @@ * Generate the releases bodies from a release Objects Array | ||
key: '_templateCommits', | ||
value: function _templateCommits(_ref7) { | ||
var sha = _ref7.sha, | ||
_ref7$commit = _ref7.commit, | ||
name = _ref7$commit.author.name, | ||
message = _ref7$commit.message, | ||
url = _ref7$commit.url; | ||
value: function _templateCommits(_ref15) { | ||
var sha = _ref15.sha, | ||
_ref15$commit = _ref15.commit, | ||
name = _ref15$commit.author.name, | ||
message = _ref15$commit.message, | ||
url = _ref15$commit.url; | ||
@@ -637,3 +842,3 @@ return (0, _template.generate)({ | ||
value: function _templateLabels(issue) { | ||
var _this6 = this; | ||
var _this4 = this; | ||
@@ -647,7 +852,7 @@ var labels = (0, _from2.default)(issue.labels); | ||
return labels.filter(function (label) { | ||
return _this6.options.ignoreLabels.indexOf(label.name) === -1; | ||
return _this4.options.ignoreLabels.indexOf(label.name) === -1; | ||
}).map(function (label) { | ||
return (0, _template.generate)({ | ||
label: label.name | ||
}, _this6.options.template.label); | ||
}, _this4.options.template.label); | ||
}).join(''); | ||
@@ -720,12 +925,12 @@ } | ||
value: function _templateGroups(groups) { | ||
var _this7 = this; | ||
var _this5 = this; | ||
return (0, _entries2.default)(groups).map(function (_ref8) { | ||
var _ref9 = (0, _slicedToArray3.default)(_ref8, 2), | ||
key = _ref9[0], | ||
value = _ref9[1]; | ||
return (0, _entries2.default)(groups).map(function (_ref16) { | ||
var _ref17 = (0, _slicedToArray3.default)(_ref16, 2), | ||
key = _ref17[0], | ||
value = _ref17[1]; | ||
var heading = (0, _template.generate)({ | ||
heading: key | ||
}, _this7.options.template.group); | ||
}, _this5.options.template.group); | ||
var body = value.join('\n'); | ||
@@ -750,4 +955,4 @@ | ||
key: '_filterCommit', | ||
value: function _filterCommit(_ref10) { | ||
var message = _ref10.commit.message; | ||
value: function _filterCommit(_ref18) { | ||
var message = _ref18.commit.message; | ||
@@ -766,8 +971,12 @@ var messageType = this.options.includeMessages; | ||
}; | ||
var shouldIgnoreMessage = this.options.ignoreCommitsWith.every(function (commitMessage) { | ||
var regex = new RegExp(commitMessage, 'i'); | ||
return !message.split('\n')[0].match(regex); | ||
}); | ||
if (filterMap[messageType]) { | ||
return filterMap[messageType](message); | ||
return filterMap[messageType](message) && shouldIgnoreMessage; | ||
} | ||
return filterMap.commits(message); | ||
return filterMap.commits(message) && shouldIgnoreMessage; | ||
} | ||
@@ -814,17 +1023,38 @@ | ||
key: '_getCommitsBetweenTwo', | ||
value: function _getCommitsBetweenTwo(since, until) { | ||
process.stdout.write(_chalk2.default.green('Get commits between ' + _utils2.default.formatDate(new Date(since)) + ' and ' + _utils2.default.formatDate(new Date(until)) + '\n')); | ||
value: function () { | ||
var _ref19 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(since, until) { | ||
var options, _ref20, data; | ||
var options = { | ||
since: since, | ||
until: until, | ||
per_page: 100 | ||
}; | ||
return _regenerator2.default.wrap(function _callee8$(_context8) { | ||
while (1) { | ||
switch (_context8.prev = _context8.next) { | ||
case 0: | ||
options = { | ||
since: since, | ||
until: until, | ||
per_page: 100 | ||
}; | ||
_context8.next = 3; | ||
return this.repo.listCommits(options); | ||
return this.repo.listCommits(options).then(function (_ref11) { | ||
var data = _ref11.data; | ||
return data; | ||
}); | ||
} | ||
case 3: | ||
_ref20 = _context8.sent; | ||
data = _ref20.data; | ||
return _context8.abrupt('return', data); | ||
case 6: | ||
case 'end': | ||
return _context8.stop(); | ||
} | ||
} | ||
}, _callee8, this); | ||
})); | ||
function _getCommitsBetweenTwo(_x12, _x13) { | ||
return _ref19.apply(this, arguments); | ||
} | ||
return _getCommitsBetweenTwo; | ||
}() | ||
/** | ||
@@ -843,20 +1073,75 @@ * Get the blocks of commits based on release dates | ||
key: '_getCommitBlocks', | ||
value: function _getCommitBlocks(releaseRanges) { | ||
var _this8 = this; | ||
value: function () { | ||
var _ref21 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(releaseRanges) { | ||
var _this6 = this; | ||
console.log(_chalk2.default.blue('\nCreating the body blocks from commits:')); | ||
var taskName, loaded, ranges; | ||
return _regenerator2.default.wrap(function _callee10$(_context10) { | ||
while (1) { | ||
switch (_context10.prev = _context10.next) { | ||
case 0: | ||
taskName = 'Creating the body blocks from commits'; | ||
loaded = _utils2.default.task(this, taskName); | ||
_context10.next = 4; | ||
return _promise2.default.all(releaseRanges.map(function () { | ||
var _ref22 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(range) { | ||
var _range, since, until, commits; | ||
return _promise2.default.all(releaseRanges.map(function (range) { | ||
return _this8._getCommitsBetweenTwo(range[1].date, range[0].date).then(function (commits) { | ||
return { | ||
id: range[0].id, | ||
name: _this8.options.prefix + range[0].name, | ||
release: range[0].name, | ||
published_at: range[0].date, | ||
body: _this8._generateCommitsBody(commits) + '\n' | ||
}; | ||
}); | ||
return _regenerator2.default.wrap(function _callee9$(_context9) { | ||
while (1) { | ||
switch (_context9.prev = _context9.next) { | ||
case 0: | ||
_range = (0, _slicedToArray3.default)(range, 2), since = _range[0].date, until = _range[1].date; | ||
_this6.tasks[taskName].text = 'Get commits between ' + _utils2.default.formatDate(new Date(since)) + ' and ' + _utils2.default.formatDate(new Date(until)); | ||
_context9.next = 4; | ||
return _this6._getCommitsBetweenTwo(range[1].date, range[0].date); | ||
case 4: | ||
commits = _context9.sent; | ||
return _context9.abrupt('return', { | ||
id: range[0].id, | ||
name: _this6.options.prefix + range[0].name, | ||
release: range[0].name, | ||
published_at: range[0].date, | ||
body: _this6._generateCommitsBody(commits) + '\n' | ||
}); | ||
case 6: | ||
case 'end': | ||
return _context9.stop(); | ||
} | ||
} | ||
}, _callee9, _this6); | ||
})); | ||
return function (_x15) { | ||
return _ref22.apply(this, arguments); | ||
}; | ||
}())); | ||
case 4: | ||
ranges = _context10.sent; | ||
loaded('Commit ranges loaded: ' + ranges.length); | ||
return _context10.abrupt('return', ranges); | ||
case 7: | ||
case 'end': | ||
return _context10.stop(); | ||
} | ||
} | ||
}, _callee10, this); | ||
})); | ||
} | ||
function _getCommitBlocks(_x14) { | ||
return _ref21.apply(this, arguments); | ||
} | ||
return _getCommitBlocks; | ||
}() | ||
/** | ||
@@ -887,4 +1172,4 @@ * Compare the ignored labels with the passed ones | ||
return ignoreIssuesWith.some(function (label) { | ||
return labels.map(function (_ref12) { | ||
var name = _ref12.name; | ||
return labels.map(function (_ref23) { | ||
var name = _ref23.name; | ||
return name; | ||
@@ -908,17 +1193,46 @@ }).includes(label); | ||
key: '_getClosedIssues', | ||
value: function _getClosedIssues(releaseRanges) { | ||
var loaded = _utils2.default.task(this, 'Getting all closed issues'); | ||
value: function () { | ||
var _ref24 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(releaseRanges) { | ||
var type, loaded, _ref25, issues; | ||
return this.issues.listIssues({ | ||
state: 'closed', | ||
since: releaseRanges[releaseRanges.length - 1][1].date | ||
}).then(function (_ref13) { | ||
var data = _ref13.data; | ||
return _regenerator2.default.wrap(function _callee11$(_context11) { | ||
while (1) { | ||
switch (_context11.prev = _context11.next) { | ||
case 0: | ||
type = { | ||
issues: 'Issues', | ||
milestones: 'Issues', | ||
prs: 'Pull Requests' | ||
}[this.options.dataSource]; | ||
loaded = _utils2.default.task(this, 'Getting all closed ' + type); | ||
_context11.next = 4; | ||
return this.issues.listIssues({ | ||
state: 'closed', | ||
since: releaseRanges[releaseRanges.length - 1][1].date | ||
}); | ||
loaded(); | ||
case 4: | ||
_ref25 = _context11.sent; | ||
issues = _ref25.data; | ||
return data; | ||
}); | ||
} | ||
loaded(type + ' found: ' + issues.length); | ||
return _context11.abrupt('return', issues); | ||
case 8: | ||
case 'end': | ||
return _context11.stop(); | ||
} | ||
} | ||
}, _callee11, this); | ||
})); | ||
function _getClosedIssues(_x16) { | ||
return _ref24.apply(this, arguments); | ||
} | ||
return _getClosedIssues; | ||
}() | ||
/** | ||
@@ -938,3 +1252,3 @@ * Group the issues based on their first label | ||
value: function _groupByLabel(issues) { | ||
var _this9 = this; | ||
var _this7 = this; | ||
@@ -945,7 +1259,7 @@ var groups = []; | ||
if (!issue.labels.length) { | ||
if (!_this9.options.template.noLabel) { | ||
if (!_this7.options.template.noLabel) { | ||
return; | ||
} | ||
issue.labels.push({ name: _this9.options.template.noLabel }); | ||
issue.labels.push({ name: _this7.options.template.noLabel }); | ||
} | ||
@@ -959,3 +1273,3 @@ | ||
groups[labelName].push(_this9._templateIssue(issue)); | ||
groups[labelName].push(_this7._templateIssue(issue)); | ||
}); | ||
@@ -980,3 +1294,3 @@ | ||
value: function _groupBy(passedIssues) { | ||
var _this10 = this; | ||
var _this8 = this; | ||
@@ -987,3 +1301,3 @@ var groupBy = this.options.groupBy; | ||
if (!groupBy) { | ||
if (!groupBy || groupBy === 'false') { | ||
return issues.map(this._templateIssue.bind(this)); | ||
@@ -1003,7 +1317,6 @@ } | ||
}, []); | ||
var groups = (0, _keys2.default)(groupBy).reduce(function (carry, group) { | ||
var groupIssues = issues.filter(function (issue) { | ||
if (!issue.labels.length && _this10.options.template.noLabel) { | ||
issue.labels.push({ name: _this10.options.template.noLabel }); | ||
if (!issue.labels.length && _this8.options.template.noLabel) { | ||
issue.labels.push({ name: _this8.options.template.noLabel }); | ||
} | ||
@@ -1016,3 +1329,3 @@ | ||
}); | ||
}).map(_this10._templateIssue.bind(_this10)); | ||
}).map(_this8._templateIssue.bind(_this8)); | ||
@@ -1043,3 +1356,6 @@ if (groupIssues.length) { | ||
value: function _filterIssue(issue) { | ||
return !issue.pull_request && !this._lablesAreIgnored(issue.labels) && !((this.options.onlyMilestones || this.options.dataSource === 'milestones') && !issue.milestone); | ||
var dataSource = this.options.dataSource; | ||
return (issue.pull_request ? dataSource === 'prs' : dataSource === 'issues' | dataSource === 'milestones') && !this._lablesAreIgnored(issue.labels) && !((this.options.onlyMilestones || dataSource === 'milestones') && !issue.milestone); | ||
} | ||
@@ -1083,25 +1399,45 @@ | ||
key: '_getIssueBlocks', | ||
value: function _getIssueBlocks(releaseRanges) { | ||
var _this11 = this; | ||
value: function () { | ||
var _ref26 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(releaseRanges) { | ||
var _this9 = this; | ||
console.log('Creating the body blocks from releases:'); | ||
var issues, release; | ||
return _regenerator2.default.wrap(function _callee12$(_context12) { | ||
while (1) { | ||
switch (_context12.prev = _context12.next) { | ||
case 0: | ||
_context12.next = 2; | ||
return this._getClosedIssues(releaseRanges); | ||
return this._getClosedIssues(releaseRanges).then(function (issues) { | ||
return releaseRanges.map(function (range) { | ||
var filteredIssues = (0, _from2.default)(issues).filter(_this11._filterIssue.bind(_this11)).filter(_this11._filterBlockIssue.bind(_this11, range)); | ||
var body = (!range[0].body || _this11.options.override) && _this11._groupBy(filteredIssues); | ||
case 2: | ||
issues = _context12.sent; | ||
release = releaseRanges.map(function (range) { | ||
var filteredIssues = (0, _from2.default)(issues).filter(_this9._filterIssue.bind(_this9)).filter(_this9._filterBlockIssue.bind(_this9, range)); | ||
var body = (!range[0].body || _this9.options.override) && _this9._groupBy(filteredIssues); | ||
process.stdout.write(_this11.options.prefix + range[0].name + ' has ' + filteredIssues.length + ' issues found\t'); | ||
return { | ||
id: range[0].id, | ||
release: range[0].name, | ||
name: _this9.options.prefix + range[0].name, | ||
published_at: range[0].date, | ||
body: _this9._templateIssueBody(body, range[0].body) | ||
}; | ||
}); | ||
return _context12.abrupt('return', release); | ||
return { | ||
id: range[0].id, | ||
release: range[0].name, | ||
name: _this11.options.prefix + range[0].name, | ||
published_at: range[0].date, | ||
body: _this11._templateIssueBody(body, range[0].body) | ||
}; | ||
}); | ||
}); | ||
} | ||
case 5: | ||
case 'end': | ||
return _context12.stop(); | ||
} | ||
} | ||
}, _callee12, this); | ||
})); | ||
function _getIssueBlocks(_x17) { | ||
return _ref26.apply(this, arguments); | ||
} | ||
return _getIssueBlocks; | ||
}() | ||
/** | ||
@@ -1167,34 +1503,58 @@ * Sort releases by dates | ||
key: '_getReleaseBlocks', | ||
value: function _getReleaseBlocks() { | ||
var _this12 = this; | ||
value: function () { | ||
var _ref27 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee13() { | ||
var loaded, dataSource, releases, tags, releaseDates; | ||
return _regenerator2.default.wrap(function _callee13$(_context13) { | ||
while (1) { | ||
switch (_context13.prev = _context13.next) { | ||
case 0: | ||
loaded = _utils2.default.task(this, 'Getting releases'); | ||
dataSource = { | ||
issues: this._getIssueBlocks.bind(this), | ||
commits: this._getCommitBlocks.bind(this), | ||
milestones: this._getIssueBlocks.bind(this), | ||
prs: this._getIssueBlocks.bind(this) | ||
}; | ||
_context13.next = 4; | ||
return this._getListReleases(); | ||
var loaded = void 0; | ||
var dataSource = { | ||
issues: this._getIssueBlocks.bind(this), | ||
commits: this._getCommitBlocks.bind(this), | ||
milestones: this._getIssueBlocks.bind(this) | ||
}; | ||
case 4: | ||
releases = _context13.sent; | ||
return this._getListReleases().then(function (releases) { | ||
loaded = _utils2.default.task(_this12, 'Getting tags'); | ||
this.tasks['Getting releases'].text = 'Getting tags'; | ||
return _this12._getLastTags(releases.length ? releases : false); | ||
}).then(function (tags) { | ||
loaded(); | ||
_context13.next = 8; | ||
return this._getLastTags(releases.length ? releases : false); | ||
console.log('Tags found: ' + tags.map(function (_ref14) { | ||
var name = _ref14.tag.name; | ||
return name; | ||
}).join(', ')); | ||
case 8: | ||
tags = _context13.sent; | ||
_context13.next = 11; | ||
return _promise2.default.all(this._getTagDates(tags)); | ||
loaded = _utils2.default.task(_this12, 'Getting the tag dates ranges'); | ||
case 11: | ||
releaseDates = _context13.sent; | ||
return _promise2.default.all(_this12._getTagDates(tags)); | ||
}).then(function (releaseDates) { | ||
loaded(); | ||
return dataSource[_this12.options.dataSource](_this12._createReleaseRanges(releaseDates)); | ||
}); | ||
} | ||
loaded('Tags found: ' + tags.map(function (_ref28) { | ||
var name = _ref28.tag.name; | ||
return name; | ||
}).join(', ')); | ||
return _context13.abrupt('return', dataSource[this.options.dataSource](this._createReleaseRanges(releaseDates))); | ||
case 14: | ||
case 'end': | ||
return _context13.stop(); | ||
} | ||
} | ||
}, _callee13, this); | ||
})); | ||
function _getReleaseBlocks() { | ||
return _ref27.apply(this, arguments); | ||
} | ||
return _getReleaseBlocks; | ||
}() | ||
/** | ||
@@ -1201,0 +1561,0 @@ * Check if there is connectivity |
@@ -23,2 +23,6 @@ 'use strict'; | ||
var _regenerator = require('babel-runtime/regenerator'); | ||
var _regenerator2 = _interopRequireDefault(_regenerator); | ||
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray'); | ||
@@ -28,2 +32,6 @@ | ||
var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator'); | ||
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2); | ||
var _assign = require('babel-runtime/core-js/object/assign'); | ||
@@ -83,12 +91,34 @@ | ||
key: 'init', | ||
value: function init() { | ||
var _this = this; | ||
value: function () { | ||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() { | ||
var options; | ||
return _regenerator2.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return this._getEnvOptions(); | ||
return this._getEnvOptions().then(function (options) { | ||
_this.options = _this._filterObject(_this._camelCaseObjectKeys((0, _assign2.default)({}, _this.defaults, _assign2.default.apply(Object, [{}].concat((0, _toConsumableArray3.default)([].concat(options)))), _this.options))); | ||
case 2: | ||
options = _context.sent; | ||
return _this.options; | ||
}); | ||
} | ||
this.options = this._filterObject(this._camelCaseObjectKeys((0, _assign2.default)({}, this.defaults, _assign2.default.apply(Object, [{}].concat((0, _toConsumableArray3.default)([].concat(options)))), this.options))); | ||
return _context.abrupt('return', this.options); | ||
case 5: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, this); | ||
})); | ||
function init() { | ||
return _ref.apply(this, arguments); | ||
} | ||
return init; | ||
}() | ||
/** | ||
@@ -133,12 +163,12 @@ * Get informations from the local folder | ||
value: function _filterObject(object) { | ||
return (0, _entries2.default)(object).filter(function (_ref) { | ||
var _ref2 = (0, _slicedToArray3.default)(_ref, 2), | ||
key = _ref2[0], | ||
value = _ref2[1]; | ||
return (0, _entries2.default)(object).filter(function (_ref2) { | ||
var _ref3 = (0, _slicedToArray3.default)(_ref2, 2), | ||
key = _ref3[0], | ||
value = _ref3[1]; | ||
return value !== undefined; | ||
}).reduce(function (carry, _ref3) { | ||
var _ref4 = (0, _slicedToArray3.default)(_ref3, 2), | ||
key = _ref4[0], | ||
value = _ref4[1]; | ||
}).reduce(function (carry, _ref4) { | ||
var _ref5 = (0, _slicedToArray3.default)(_ref4, 2), | ||
key = _ref5[0], | ||
value = _ref5[1]; | ||
@@ -169,6 +199,6 @@ carry[key] = value; | ||
(0, _entries2.default)(events).forEach(function (_ref5) { | ||
var _ref6 = (0, _slicedToArray3.default)(_ref5, 2), | ||
event = _ref6[0], | ||
action = _ref6[1]; | ||
(0, _entries2.default)(events).forEach(function (_ref6) { | ||
var _ref7 = (0, _slicedToArray3.default)(_ref6, 2), | ||
event = _ref7[0], | ||
action = _ref7[1]; | ||
@@ -196,7 +226,7 @@ program.on(event, action); | ||
value: function _programWithOptions(program, options) { | ||
options.forEach(function (_ref7) { | ||
var name = _ref7.name, | ||
description = _ref7.description, | ||
action = _ref7.action, | ||
defaultValue = _ref7.defaultValue; | ||
options.forEach(function (_ref8) { | ||
var name = _ref8.name, | ||
description = _ref8.description, | ||
action = _ref8.action, | ||
defaultValue = _ref8.defaultValue; | ||
return program.option.apply(program, (0, _toConsumableArray3.default)([name, description, action, defaultValue].filter(Boolean))); | ||
@@ -230,9 +260,9 @@ }); | ||
var programOptions = opts.map(function (_ref8) { | ||
var short = _ref8.short, | ||
name = _ref8.name, | ||
valueType = _ref8.valueType, | ||
description = _ref8.description, | ||
defaultValue = _ref8.defaultValue, | ||
action = _ref8.action; | ||
var programOptions = opts.map(function (_ref9) { | ||
var short = _ref9.short, | ||
name = _ref9.name, | ||
valueType = _ref9.valueType, | ||
description = _ref9.description, | ||
defaultValue = _ref9.defaultValue, | ||
action = _ref9.action; | ||
return { | ||
@@ -298,3 +328,3 @@ name: short && name ? short + ', --' + name + ' ' + (valueType || '') : ' ', | ||
value: function _camelCaseObjectKeys() { | ||
var _this2 = this; | ||
var _this = this; | ||
@@ -307,8 +337,8 @@ var object = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
return (0, _entries2.default)(object).reduce(function (carry, _ref9) { | ||
var _ref10 = (0, _slicedToArray3.default)(_ref9, 2), | ||
key = _ref10[0], | ||
value = _ref10[1]; | ||
return (0, _entries2.default)(object).reduce(function (carry, _ref10) { | ||
var _ref11 = (0, _slicedToArray3.default)(_ref10, 2), | ||
key = _ref11[0], | ||
value = _ref11[1]; | ||
carry[_this2._dashToCamelCase(key)] = value; | ||
carry[_this._dashToCamelCase(key)] = value; | ||
return carry; | ||
@@ -315,0 +345,0 @@ }, {}); |
{ | ||
"name": "github-release-notes", | ||
"version": "0.12.1", | ||
"version": "0.12.2", | ||
"description": "Create a release from a tag and uses issues or commits to creating the release notes. It also can generate a CHANGELOG.md file based on the release notes (or generate a brand new).", | ||
@@ -47,2 +47,3 @@ "main": "./github-release-notes.js", | ||
"dependencies": { | ||
"babel-runtime": "^6.26.0", | ||
"chalk": "^2.1.0", | ||
@@ -54,6 +55,7 @@ "commander": "^2.11.0", | ||
"object-assign-deep": "^0.3.1", | ||
"ora": "^1.3.0", | ||
"require-yaml": "0.0.1" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.24.1", | ||
"babel-cli": "^6.26.0", | ||
"babel-eslint": "^8.0.0", | ||
@@ -64,2 +66,3 @@ "babel-plugin-istanbul": "^4.1.5", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-es2017": "^6.24.1", | ||
"babel-register": "^6.24.1", | ||
@@ -66,0 +69,0 @@ "chai": "^4.1.2", |
Sorry, the diff of this file is not supported yet
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
291442
23
2716
9
29
6
+ Addedbabel-runtime@^6.26.0
+ Addedora@^1.3.0
+ Addedbabel-runtime@6.26.0(transitive)
+ Addedcli-cursor@2.1.0(transitive)
+ Addedcli-spinners@1.3.1(transitive)
+ Addedcore-js@2.6.12(transitive)
+ Addedlog-symbols@2.2.0(transitive)
+ Addedmimic-fn@1.2.0(transitive)
+ Addedonetime@2.0.1(transitive)
+ Addedora@1.4.0(transitive)
+ Addedregenerator-runtime@0.11.1(transitive)
+ Addedrestore-cursor@2.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)