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:
authorRebecca Turner <me@re-becca.org>2016-07-08 01:18:16 +0300
committerRebecca Turner <me@re-becca.org>2016-07-08 01:23:22 +0300
commit7ef7cf4bba0bed4419f330d7e99d5bb54ad2a2c5 (patch)
tree5c4cef9633551c337c7b50f338515725c10decdd /scripts
parente28f67574dbe1df27f2fd5323587758ed901c41a (diff)
scripts: Match non-npm URLs in fixes for changelogs
Diffstat (limited to 'scripts')
-rw-r--r--scripts/changelog.js35
1 files changed, 24 insertions, 11 deletions
diff --git a/scripts/changelog.js b/scripts/changelog.js
index b4a9d55fd..729dc6ce6 100644
--- a/scripts/changelog.js
+++ b/scripts/changelog.js
@@ -13,7 +13,7 @@ the result to the changelog.
*/
const execSync = require('child_process').execSync
const branch = process.argv[2] || 'master'
-const log = execSync(`git log --pretty='format:%h %H%d %s (%aN)%n%b%n---%n' ${branch}...`).toString().split(/\n/)
+const log = execSync(`git log --reverse --pretty='format:%h %H%d %s (%aN)%n%b%n---%n' ${branch}...`).toString().split(/\n/)
const authormap = {
'Rebecca Turner': 'iarna',
'Forrest L Norvell': 'othiym23',
@@ -24,21 +24,34 @@ const authormap = {
main()
+function shortname (url) {
+ let matched = url.match(/https:\/\/github.com\/([^/]+\/[^/]+)\/(?:pull|issues)\/(\d+)/)
+ if (!matched) return false
+ let repo = matched[1]
+ let id = matched[2]
+ if (repo !== 'npm/npm') {
+ return `${repo}#${id}`
+ } else {
+ return `#${id}`
+ }
+}
+
function print_commit (c) {
- let m
console.log(`* [\`${c.shortid}\`](https://github.com/npm/npm/commit/${c.fullid})`)
if (c.fixes) {
- console.log(` [#${c.fixes}](https://github.com/npm/npm/issues/${c.fixes})`)
- } else if (c.prurl && (m = c.prurl.match(/https:\/\/github.com\/([^/]+\/[^/]+)\/pull\/(\d+)/))) {
- let repo = m[1]
- let prid = m[2]
- if (repo !== 'npm/npm') {
- console.log(` [${repo}#${prid}](${c.prurl})`)
+ let label = shortname(c.fixes)
+ if (label) {
+ console.log(` [${label}](${c.fixes})`)
} else {
- console.log(` [#${prid}](${c.prurl})`)
+ console.log(` [#${c.fixes}](https://github.com/npm/npm/issues/${c.fixes})`)
}
} else if (c.prurl) {
- console.log(` [#](${c.prurl})`)
+ let label = shortname(c.prurl)
+ if (label) {
+ console.log(` [${label}](${c.prurl})`)
+ } else {
+ console.log(` [#](${c.prurl})`)
+ }
}
let msg = c.message
.replace(/^\s+/mg, '')
@@ -84,7 +97,7 @@ function main () {
} else if (m = line.match(/^Credit: @(.*)/)) {
if (!commit.credit) commit.credit = []
commit.credit.push(m[1])
- } else if (m = line.match(/^Fixes: (?:#|https:[/][/]github.com[/]npm[/]npm[/]issues[/])(.*)/)) {
+ } else if (m = line.match(/^Fixes: (?:#|https:[/][/]github.com[/]([^/]+[/][^/]+)[/]issues[/])(.*)/)) {
commit.fixes = m[1]
} else if (m = line.match(/^Reviewed-By: @(.*)/)) {
commit.reviewed = m[1]