"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "scripts/changelog.js" between
npm-cli-7.16.0.tar.gz and npm-cli-7.17.0.tar.gz

About: npm is a JavaScript package manager (requires node v6 or higher).

changelog.js  (npm-cli-7.16.0):changelog.js  (npm-cli-7.17.0)
skipping to change at line 21 skipping to change at line 21
the result to the changelog. the result to the changelog.
*/ */
const execSync = require('child_process').execSync const execSync = require('child_process').execSync
const branch = process.argv[2] || 'origin/latest' const branch = process.argv[2] || 'origin/latest'
const log = execSync(`git log --reverse --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/)
main() main()
function shortname (url) { function shortname (url) {
let matched = url.match(/https:\/\/github\.com\/([^/]+\/[^/]+)\/(?:pull|issues )\/(\d+)/) || const matched = url.match(/https:\/\/github\.com\/([^/]+\/[^/]+)\/(?:pull|issu es)\/(\d+)/) ||
url.match(/https:\/\/(npm\.community)\/t\/(?:[^/]+\/)(\d+)/) url.match(/https:\/\/(npm\.community)\/t\/(?:[^/]+\/)(\d+)/)
if (!matched) return false if (!matched)
let repo = matched[1] return false
let id = matched[2] const repo = matched[1]
if (repo !== 'npm/cli') { const id = matched[2]
if (repo !== 'npm/cli')
return `${repo}#${id}` return `${repo}#${id}`
} else { else
return `#${id}` return `#${id}`
}
} }
function printCommit (c) { function printCommit (c) {
console.log(`* [\`${c.shortid}\`](https://github.com/npm/cli/commit/${c.fullid })`) console.log(`* [\`${c.shortid}\`](https://github.com/npm/cli/commit/${c.fullid })`)
if (c.fixes.length) { if (c.fixes.length) {
for (const fix of c.fixes) { for (const fix of c.fixes) {
let label = shortname(fix) const label = shortname(fix)
if (label) { if (label)
console.log(` [${label}](${fix})`) console.log(` [${label}](${fix})`)
}
} }
} else if (c.prurl) { } else if (c.prurl) {
let label = shortname(c.prurl) const label = shortname(c.prurl)
if (label) { if (label)
console.log(` [${label}](${c.prurl})`) console.log(` [${label}](${c.prurl})`)
} else { else
console.log(` [#](${c.prurl})`) console.log(` [#](${c.prurl})`)
}
} }
let msg = c.message const msg = c.message
.replace(/^\s+/mg, '') .replace(/^\s+/mg, '')
.replace(/^[-a-z]+: /, '') .replace(/^[-a-z]+: /, '')
.replace(/^/mg, ' ') .replace(/^/mg, ' ')
.replace(/^ Reviewed-by: @.*/mg, '') .replace(/^ {2}Reviewed-by: @.*/mg, '')
.replace(/\n$/, '') .replace(/\n$/, '')
// backtickify package@version // backtickify package@version
.replace(/^(\s*@?[^@\s]+@\d+[.]\d+[.]\d+)\b(\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`') .replace(/((?:\b|@)[^@\s]+@\d+[.]\d+[.]\d+)\b/g, '`$1`')
// linkify commitids // linkify commitids
.replace(/\b([a-f0-9]{7,8})\b/g, '[`$1`](https://github.com/npm/cli/commit/$ 1)') .replace(/\b([a-f0-9]{7,8})\b/g, '[`$1`](https://github.com/npm/cli/commit/$ 1)')
console.log(msg) console.log(msg)
// don't assign credit for dep updates // don't assign credit for dep updates
if (!/^ `[^`]+@\d+\.\d+\.\d+[^`]*`:?$/m.test(msg)) { if (!/^ {2}`[^`]+@\d+\.\d+\.\d+[^`]*`:?$/m.test(msg)) {
if (c.credit) { if (c.credit) {
c.credit.forEach(function (credit) { c.credit.forEach(function (credit) {
console.log(` ([@${credit}](https://github.com/${credit}))`) console.log(` ([@${credit}](https://github.com/${credit}))`)
}) })
} else { } else
console.log(` ([@${c.author}](https://github.com/${c.author}))`) console.log(` ([@${c.author}](https://github.com/${c.author}))`)
}
} }
} }
function main () { function main () {
let commit let commit
log.forEach(function (line) { log.forEach(function (line) {
line = line.replace(/\r/g, '') line = line.replace(/\r/g, '')
let m let m
/* eslint no-cond-assign:0 */ /* eslint no-cond-assign:0 */
if (/^---$/.test(line)) { if (/^---$/.test(line))
printCommit(commit) printCommit(commit)
} else if (m = line.match(/^([a-f0-9]{7,10}) ([a-f0-9]+) (?:[(]([^)]+)[)] )? (.*?) [(](.*?)[)]/)) { else if (m = line.match(/^([a-f0-9]{7,10}) ([a-f0-9]+) (?:[(]([^)]+)[)] )?(. *?) [(](.*?)[)]/)) {
commit = { commit = {
shortid: m[1], shortid: m[1],
fullid: m[2], fullid: m[2],
branch: m[3], branch: m[3],
message: m[4], message: m[4],
author: m[5], author: m[5],
prurl: null, prurl: null,
fixes: [], fixes: [],
credit: null credit: null,
} }
} else if (m = line.match(/^PR-URL: (.*)/)) { } else if (m = line.match(/^PR-URL: (.*)/))
commit.prurl = m[1] commit.prurl = m[1]
} else if (m = line.match(/^Credit: @(.*)/)) { else if (m = line.match(/^Credit: @(.*)/)) {
if (!commit.credit) commit.credit = [] if (!commit.credit)
commit.credit = []
commit.credit.push(m[1]) commit.credit.push(m[1])
} else if (m = line.match(/^(?:Fix(?:es)|Closes?): #?([0-9]+)/)) { } else if (m = line.match(/^(?:Fix(?:es)|Closes?): #?([0-9]+)/))
commit.fixes.push(`https://github.com/npm/cli/issues/${m[1]}`) commit.fixes.push(`https://github.com/npm/cli/issues/${m[1]}`)
} else if (m = line.match(/^(?:Fix(?:es)|Closes?): ([^#]+)#([0-9]*)/)) { else if (m = line.match(/^(?:Fix(?:es)|Closes?): ([^#]+)#([0-9]*)/))
commit.fixes.push(`https://github.com/${m[1]}/issues/${m[2]}`) commit.fixes.push(`https://github.com/${m[1]}/issues/${m[2]}`)
} else if (m = line.match(/^(?:Fix(?:es)|Closes?): (https?:\/\/.*)/)) { else if (m = line.match(/^(?:Fix(?:es)|Closes?): (https?:\/\/.*)/))
commit.fixes.push(m[1]) commit.fixes.push(m[1])
} else if (m = line.match(/^Reviewed-By: @(.*)/)) { else if (m = line.match(/^Reviewed-By: @(.*)/))
commit.reviewed = m[1] commit.reviewed = m[1]
} else if (/\S/.test(line)) { else if (/\S/.test(line))
commit.message += `\n${line}` commit.message += `\n${line}`
}
}) })
} }
 End of changes. 25 change blocks. 
31 lines changed or deleted 28 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)