diff --git a/.all-contributorsrc b/.all-contributorsrc index 4b4e4a60..57029ebd 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -187,6 +187,15 @@ "contributions": [ "code" ] + }, + { + "login": "viatrix", + "name": "Tanya Bushenyova", + "avatar_url": "https://avatars.githubusercontent.com/u/16937734?v=4", + "profile": "https://github.com/viatrix", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/.travis.yml b/.travis.yml index d8a55715..ab328b7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,9 @@ language: - node_js node_js: - - "8" - "10" + - "12" + - "14" before_install: - npm install -g gulp-cli diff --git a/README.md b/README.md index 80d73972..5965d7bb 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ [![npm downloads](https://img.shields.io/npm/dm/github-release-notes.svg)](https://www.npmjs.com/package/github-release-notes) [![Automated Release Notes by gren](https://img.shields.io/badge/%F0%9F%A4%96-release%20notes-00B2EE.svg)](https://github-tools.github.io/github-release-notes/) -[![All Contributors](https://img.shields.io/badge/all_contributors-20-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-21-orange.svg?style=flat-square)](#contributors-) ## OK, what can `gren` do for me? @@ -226,35 +226,37 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + +

Dan Klausner

πŸ› πŸ’»

David Sevilla MartΓ­n

πŸ“–

Alexander Vassbotn RΓΈyne-Helgesen

πŸ› πŸ’»

Joaquin Corchero

πŸ’»

David Parker

πŸ’»

Mario Tacke

πŸ’»

Kevin Yeh

πŸ’»

Dan Klausner

πŸ› πŸ’»

David Sevilla MartΓ­n

πŸ“–

Alexander Vassbotn RΓΈyne-Helgesen

πŸ› πŸ’»

Joaquin Corchero

πŸ’»

David Parker

πŸ’»

Mario Tacke

πŸ’»

Kevin Yeh

πŸ’»

Jack O'Connor

πŸ’»

Keith Stolte

πŸ“– 🎨

David Poindexter

πŸ“–

Frank S. Thomas

πŸ’»

pawk

πŸ’»

Yang, Bo

πŸ’»

Victor Martinez

πŸ“–

Jack O'Connor

πŸ’»

Keith Stolte

πŸ“– 🎨

David Poindexter

πŸ“–

Frank S. Thomas

πŸ’»

pawk

πŸ’»

Yang, Bo

πŸ’»

Victor Martinez

πŸ“–

Tyler Hogan

πŸ’»

Blair Gemmer

πŸ“–

Han

πŸ’»

donmahallem

πŸ’»

Ahmed

πŸ’»

MΓ΄nica Ribeiro

πŸ’»

Tyler Hogan

πŸ’»

Blair Gemmer

πŸ“–

Han

πŸ’»

donmahallem

πŸ’»

Ahmed

πŸ’»

MΓ΄nica Ribeiro

πŸ’»

Tanya Bushenyova

πŸ’»
- + + This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! diff --git a/lib/gren-changelog.js b/lib/gren-changelog.js index 04717e67..30606d2c 100644 --- a/lib/gren-changelog.js +++ b/lib/gren-changelog.js @@ -32,4 +32,5 @@ changelogCommand.init() }) .catch(error => { console.error(error); + process.exit(1); }); diff --git a/lib/src/Gren.js b/lib/src/Gren.js index 67d3cafe..7833b677 100644 --- a/lib/src/Gren.js +++ b/lib/src/Gren.js @@ -536,7 +536,7 @@ class Gren { const labels = Array.from(issue.labels); if (!labels.length && this.options.template.noLabel) { - labels.push({name: this.options.template.noLabel}); + labels.push({ name: this.options.template.noLabel }); } return labels @@ -606,13 +606,16 @@ class Gren { * @return {string} */ _templateGroups(groups) { + const { groupPostProcessor } = this.options; + return Object.entries(groups).map(([key, value]) => { const heading = generate({ heading: key }, this.options.template.group); const body = value.join('\n'); + const content = heading + '\n' + body; - return heading + '\n' + body; + return groupPostProcessor ? groupPostProcessor(content) : content; }); } @@ -804,7 +807,7 @@ class Gren { return; } - issue.labels.push({name: this.options.template.noLabel}); + issue.labels.push({ name: this.options.template.noLabel }); } const labelName = issue.labels[0].name; @@ -849,7 +852,7 @@ class Gren { const groups = Object.keys(groupBy).reduce((carry, group, i, arr) => { const groupIssues = issues.filter(issue => { if (!issue.labels.length && this.options.template.noLabel) { - issue.labels.push({name: this.options.template.noLabel}); + issue.labels.push({ name: this.options.template.noLabel }); } return issue.labels.some(label => { @@ -1093,7 +1096,7 @@ class Gren { }); } - for (let i = 0; i < sortedReleaseDates.length - 1; i++) { + for (let i = 0; i < sortedReleaseDates.length - RANGE + 1; i++) { const until = sortedReleaseDates[i + 1].date; ranges.push([ sortedReleaseDates[i], diff --git a/package-lock.json b/package-lock.json index a9fbf784..4b826714 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "github-release-notes", - "version": "0.17.1", + "version": "0.17.3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2140,14 +2140,6 @@ "integrity": "sha512-LQdY3j4PxuUl6xfxiFruTSlCniTrTrzAd8/HfsLEMi0PUpaQ0Iy+Pr4N4VllDYjs0Hyu2lkTbvzqlG+PX9NsNw==", "dev": true }, - "encoding": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", - "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", - "requires": { - "iconv-lite": "~0.4.13" - } - }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", @@ -5173,7 +5165,8 @@ "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true }, "is-unc-path": { "version": "1.0.0", @@ -5494,9 +5487,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha1-tEf2ZwoEVbv+7dETku/zMOoJdUg=" + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" }, "lodash._basecopy": { "version": "3.0.1", @@ -6251,13 +6244,9 @@ "dev": true }, "node-fetch": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", - "integrity": "sha1-mA9vcthSEaU0fGsrwYxbhMPrR+8=", - "requires": { - "encoding": "^0.1.11", - "is-stream": "^1.0.1" - } + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" }, "nopt": { "version": "4.0.1", diff --git a/package.json b/package.json index e5bcce34..8b2956c2 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "js-beautify": "^1.7.4", "json2yaml": "^1.1.0", "minimist": "^1.2.0", - "node-fetch": "^1.7.3", + "node-fetch": "^2.6.1", "npm": "^6.13.4", "object-assign-deep": "^0.3.1", "ora": "^1.3.0", diff --git a/test/Gren.spec.js b/test/Gren.spec.js index b268b412..18da7585 100644 --- a/test/Gren.spec.js +++ b/test/Gren.spec.js @@ -211,6 +211,22 @@ describe('Gren', () => { }; assert.deepEqual(gren._groupBy(normal), [`All\n${normal[0].title}`], 'The issue does not match any labels, and goes in the ... group'); }); + + it('Should format group using post formatter', () => { + const { normal, noLabel } = issues; + + gren.options.groupBy = { + 'Test:': ['enhancement'], + 'Others:': ['closed'] + }; + + gren.options.groupPostProcessor = (groupContent) => { + return groupContent.replace(0, groupContent.indexOf(':\n') + 3); + } + + assert.deepEqual(gren._groupBy(normal), [`Test:`], 'Passing one heading for one issue'); + assert.deepEqual(gren._groupBy(noLabel), [`Others:`], 'Group option is "label" with no labels'); + }); }); describe('_filterIssue', () => { @@ -544,9 +560,10 @@ describe('Gren', () => { const receivedObject = gren._transformTagsIntoReleaseObjects([tag]); - assert.equals(tag.date, receivedObject.date); - assert.equals(tag.releaseId, receivedObject.id); - assert.equals(tag.name, receivedObject.name); + assert.equal(1, receivedObject.length) + assert.equal(tag.date, receivedObject[0].date); + assert.equal(tag.releaseId, receivedObject[0].id); + assert.equal(tag.tag.name, receivedObject[0].name); }); }); @@ -609,11 +626,11 @@ describe('Gren', () => { describe('with tags=all', () => { describe('with ignoreTagsWith', () => { it('should ignore the specific tag', done => { - gren.options.ignoreTagsWith = ['11']; + gren.options.ignoreTagsWith = ['16']; gren.options.tags = ['all']; gren._getLastTags() .then(tags => { - assert.notInclude(tags.map(({ name }) => name), '0.11.0', 'The ignored tag is not present'); + assert.notInclude(tags.map(({ name }) => name), '0.16.0', 'The ignored tag is not present'); done(); }) .catch(err => done(err)); @@ -624,7 +641,8 @@ describe('Gren', () => { describe('_getReleaseBlocks', () => { it('more than one tag', done => { - gren.options.tags = ['0.12.0', '0.11.0']; + gren.options.tags = ['0.17.2', '0.17.1']; + gren.options.dataSource = "commits"; gren._getReleaseBlocks() .then(releaseBlocks => { assert.isArray(releaseBlocks, 'The releaseBlocks is an Array'); @@ -637,7 +655,8 @@ describe('Gren', () => { }).timeout(10000); it('just one tag', done => { - gren.options.tags = ['0.11.0']; + gren.options.tags = ['0.17.2']; + gren.options.dataSource = "commits"; gren._getReleaseBlocks() .then(releaseBlocks => { assert.isArray(releaseBlocks, 'The releaseBlocks is an Array'); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy