Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2020-11-04 01:37:51 +0300
committerisaacs <i@izs.me>2020-11-04 01:53:06 +0300
commitfea7da32a24f0b65770d837eaf574f2cc526efaa (patch)
treee533feb27205c469e7dc1b64b00dfb305f728b63 /scripts
parente0302a02109d31ce099f1c2c92a6d4dd53abcce6 (diff)
doc: updates to changelog generation script
Less manual effort paper cuts.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/changelog.js41
1 files changed, 24 insertions, 17 deletions
diff --git a/scripts/changelog.js b/scripts/changelog.js
index 0e84fc24f..f36ad56c9 100644
--- a/scripts/changelog.js
+++ b/scripts/changelog.js
@@ -32,12 +32,12 @@ function shortname (url) {
function printCommit (c) {
console.log(`* [\`${c.shortid}\`](https://github.com/npm/cli/commit/${c.fullid})`)
- if (c.fixes) {
- let label = shortname(c.fixes)
- if (label) {
- console.log(` [${label}](${c.fixes})`)
- } else {
- console.log(` [npm.community#${c.fixes}](https://npm.community/t/${c.fixes})`)
+ if (c.fixes.length) {
+ for (const fix of c.fixes) {
+ let label = shortname(fix)
+ if (label) {
+ console.log(` [${label}](${fix})`)
+ }
}
} else if (c.prurl) {
let label = shortname(c.prurl)
@@ -51,20 +51,23 @@ function printCommit (c) {
.replace(/^\s+/mg, '')
.replace(/^[-a-z]+: /, '')
.replace(/^/mg, ' ')
+ .replace(/^ Reviewed-by: @.*/mg, '')
.replace(/\n$/, '')
// backtickify package@version
- .replace(/^(\s*@?[^@\s]+@\d+[.]\d+[.]\d+)(\s*\S)/g, '$1:$2')
+ .replace(/^(\s*@?[^@\s]+@\d+[.]\d+[.]\d+)\b(\s*\S)/g, '$1:$2')
.replace(/((?:\b|@)[^@\s]+@\d+[.]\d+[.]\d+)\b/g, '`$1`')
// linkify commitids
.replace(/\b([a-f0-9]{7,8})\b/g, '[`$1`](https://github.com/npm/cli/commit/$1)')
- .replace(/\b#(\d+)\b/g, '[#$1](https://npm.community/t/$1)')
console.log(msg)
- if (c.credit) {
- c.credit.forEach(function (credit) {
- console.log(` ([@${credit}](https://github.com/${credit}))`)
- })
- } else {
- console.log(` ([@${c.author}](https://github.com/${c.author}))`)
+ // don't assign credit for dep updates
+ if (!/^ `[^`]+@\d+\.\d+\.\d+[^`]*`:?$/m.test(msg)) {
+ if (c.credit) {
+ c.credit.forEach(function (credit) {
+ console.log(` ([@${credit}](https://github.com/${credit}))`)
+ })
+ } else {
+ console.log(` ([@${c.author}](https://github.com/${c.author}))`)
+ }
}
}
@@ -84,7 +87,7 @@ function main () {
message: m[4],
author: m[5],
prurl: null,
- fixes: null,
+ fixes: [],
credit: null
}
} else if (m = line.match(/^PR-URL: (.*)/)) {
@@ -92,8 +95,12 @@ function main () {
} else if (m = line.match(/^Credit: @(.*)/)) {
if (!commit.credit) commit.credit = []
commit.credit.push(m[1])
- } else if (m = line.match(/^Fixes: #?(.*)/)) {
- commit.fixes = m[1]
+ } else if (m = line.match(/^(?:Fix(?:es)|Closes?): #?([0-9]+)/)) {
+ commit.fixes.push(`https://github.com/npm/cli/issues/${m[1]}`)
+ } else if (m = line.match(/^(?:Fix(?:es)|Closes?): ([^#]+)#([0-9]*)/)) {
+ commit.fixes.push(`https://github.com/${m[1]}/issues/${m[2]}`)
+ } else if (m = line.match(/^(?:Fix(?:es)|Closes?): (https?:\/\/.*)/)) {
+ commit.fixes.push(m[1])
} else if (m = line.match(/^Reviewed-By: @(.*)/)) {
commit.reviewed = m[1]
} else if (/\S/.test(line)) {