diff --git a/scripts/generate-changelog.js b/scripts/generate-changelog.js index 4adf27165f..c58aeb378c 100644 --- a/scripts/generate-changelog.js +++ b/scripts/generate-changelog.js @@ -10,69 +10,74 @@ const AUTHORS = { "Carlos Castro": "srinaath", "Chris Whitten": "cwhitten", "Dong Lei": "boydc2014", + "Fei Chen": "feich-ms", "Gary Pretty": "garypretty", "Geoff Cox (Microsoft)": "GeoffCoxMSFT", "Hongyang Du (hond)": "Danieladu", "Kamran Iqbal": "Kaiqb", "Long Alan": "alanlong9278", + LouisEugeneMSFT: "leugene-microsoft", "Lu Han": "luhan2017", - "mareekuh": "mareekuh", + mareekuh: "mareekuh", + pavolum: "pavolum", "Pooja Nagpal": "p-nagpal", "Qi Kang": "zidaneymar", - "sangwoohaan": "srinaath", + sangwoohaan: "srinaath", "Shuai Wang": "cosmicshuai", + Soroush: "hatpick", "Srinaath Ravichandran": "srinaath", + taicchoumsft: "taicchoumsft", "TJ Durnford": "tdurnford", "Tony Anziano": "tonyanziano", "Vishwac Sena Kannan": "vishwacsena", "Weitian Li": "liweitian", "Yan Liu": "zxyanliu", "Zhixiang Zhan": "zhixzhan", + zxyanliu: "zxyanliu", Corina: "corinagum", leileizhang: "lei9444", liweitian: "liweitian", + mewa1024: "mewa1024", VanyLaw: "VanyLaw", xieofxie: "xieofxie", zeye: "yeze322", zhixzhan: "zhixzhan", - "LouisEugeneMSFT": "leugene-microsoft" }; const getLatestTag = () => - execSync("git describe --tags $(git rev-list --tags --max-count=1)").toString().trim(); + execSync("git describe --tags $(git rev-list --tags --max-count=1)") + .toString() + .trim(); const getLog = (tag) => execSync(`git log --pretty=format:'%s | %an' ${tag}..main`) .toString() .split("\n"); -const getDate = () => - execSync('date +"%m-%d-%Y"') - .toString() - .trim(); +const getDate = () => execSync('date +"%m-%d-%Y"').toString().trim(); const SECTIONS = { Added: ["feat"], Fixed: ["fix", "a11y"], Changed: ["refactor", "style"], - Other: [] + Other: [], }; const tagToSection = Object.keys(SECTIONS).reduce((acc, section) => { const groupTags = SECTIONS[section].reduce( (s, t) => ({ ...s, - [t]: section + [t]: section, }), {} ); return { ...acc, - ...groupTags + ...groupTags, }; }, {}); -const getCommitSection = commit => { +const getCommitSection = (commit) => { for (const tag in tagToSection) { if (commit.startsWith(tag)) { return tagToSection[tag]; @@ -84,7 +89,7 @@ const getCommitSection = commit => { return "Other"; }; -const formatMessage = msg => +const formatMessage = (msg) => msg.replace(/\(\#(\d+)\)/, `([#$1](${PULL_URL}/$1))`); const logCache = new Set(); @@ -95,7 +100,7 @@ const logOnce = (key, message) => { } }; -const formatAuthor = author => { +const formatAuthor = (author) => { const username = AUTHORS[author]; if (!username) { @@ -106,7 +111,7 @@ const formatAuthor = author => { return `([@${username}](https://github.com/${username}))`; }; -const formatCommit = commit => { +const formatCommit = (commit) => { const [message, author] = commit.split(" | "); return [formatMessage(message), formatAuthor(author)]; @@ -127,7 +132,7 @@ function groupCommits(commits) { }, {}); } -const formatChangeLog = groups => { +const formatChangeLog = (groups) => { const date = getDate(); let output = `### ${date}`; @@ -135,14 +140,14 @@ const formatChangeLog = groups => { if (groups[section] && groups[section].length > 0) { output += `\n\n#### ${section}\n\n`; - output += groups[section].map(c => `- ${c}`).join("\n"); + output += groups[section].map((c) => `- ${c}`).join("\n"); } } // Uncategorized if (groups.Uncategorized) { output += "\n\n Uncategorized\n\n"; - output += groups.Uncategorized.map(c => `- ${c}`).join("\n"); + output += groups.Uncategorized.map((c) => `- ${c}`).join("\n"); } return output;