From 62c9289306d4b9abd7170d0fbdf29b25a4dd112c Mon Sep 17 00:00:00 2001 From: HarikrishnanBalagopal Date: Thu, 17 Dec 2020 17:26:09 +0530 Subject: [PATCH 1/8] fix: index out of range bug (#289) The for loop condition needs to depend on the RANGE, otherwise it the index will go out of range when we access i + RANGE - 1 inside the for loop. Signed-off-by: Harikrishnan Balagopal --- lib/src/Gren.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/Gren.js b/lib/src/Gren.js index 67d3cafe..473fc06f 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 @@ -804,7 +804,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 +849,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 +1093,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], From 6734707b88da3d150f349ecb366861a4d835bd52 Mon Sep 17 00:00:00 2001 From: Yuta Shimizu Date: Thu, 17 Dec 2020 20:56:58 +0900 Subject: [PATCH 2/8] Fix failing test (#281) * Fix failing specs * Fix tests that require network Target tags should be listed in the first 10. `gren.options.dataSource` seems required in `_getReleaseBlocks()` --- test/Gren.spec.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/test/Gren.spec.js b/test/Gren.spec.js index b268b412..94a2bc04 100644 --- a/test/Gren.spec.js +++ b/test/Gren.spec.js @@ -544,9 +544,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 +610,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 +625,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 +639,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'); From 458289f05ac3a2b45c8ccaf5eddee2d2a4234525 Mon Sep 17 00:00:00 2001 From: Yogev Ben David Date: Thu, 17 Dec 2020 13:57:49 +0200 Subject: [PATCH 3/8] Add group post processor (#286) * Add post group formatter * Push dist and bin * Rename postGroupFormatter to groupPostProcessor * Revert "Push dist and bin" This reverts commit 02d5b21de8fc93952b6e1e594e7e8a2a6a4e39ee. * f * f * remove clg --- lib/src/Gren.js | 5 ++++- test/Gren.spec.js | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/src/Gren.js b/lib/src/Gren.js index 473fc06f..7833b677 100644 --- a/lib/src/Gren.js +++ b/lib/src/Gren.js @@ -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; }); } diff --git a/test/Gren.spec.js b/test/Gren.spec.js index 94a2bc04..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', () => { From 8b94c98f4795b293693d48bf4fc57754371e79a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Dec 2020 12:58:10 +0100 Subject: [PATCH 4/8] Bump node-fetch from 1.7.3 to 2.6.1 (#280) Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 1.7.3 to 2.6.1. - [Release notes](https://github.com/bitinn/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md) - [Commits](https://github.com/bitinn/node-fetch/compare/1.7.3...v2.6.1) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 23 ++++++----------------- package.json | 2 +- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index a9fbf784..070f1b29 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", @@ -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", From 305e5c67073223d4da830448432407d978fee0cc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Dec 2020 12:58:23 +0100 Subject: [PATCH 5/8] Bump lodash from 4.17.15 to 4.17.19 (#275) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 070f1b29..4b826714 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5487,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", From 69b77665dddb1135a81ce856a7c8edb1003dbc45 Mon Sep 17 00:00:00 2001 From: Tanya Bushenyova Date: Thu, 25 Mar 2021 12:50:51 +0200 Subject: [PATCH 6/8] Return exit code 1 on error for gren changelog (#294) --- lib/gren-changelog.js | 1 + 1 file changed, 1 insertion(+) 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); }); From 8beb6f013cdfe410a0c20cd48291efe4c92a8ace Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 25 Mar 2021 11:51:23 +0100 Subject: [PATCH 7/8] docs: add viatrix as a contributor (#297) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 46 +++++++++++++++++++++++---------------------- 2 files changed, 33 insertions(+), 22 deletions(-) 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/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! From ff0ddae3938db3cfcca5ef317d74eee034c32cc5 Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Thu, 25 Mar 2021 06:59:07 -0400 Subject: [PATCH 8/8] Update supported NodeJS versions to current (#291) --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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