-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools: generate authors list automatically
* Add new `update-authors.js` tool that traverses commit history using `git log` and creates authors list. * Decouple common functions into a module shared between tools. * Add `.mailmap` file. This file is automatically parsed by Git so that `git log --format='%aN <%aE>'` won't show duplicate entries in case something was committed with misconfigured Git. E.g., without this file @tshemsedinov appears twice in the list, as Timur Shemsedinov and as tshemsedinov, but with mailmap applied Git automatically coalesces these entries to use the full name only. This file now includes the active collaborators (@tshemsedinov for a reason and @aqrln and @belochub just in case), proper names and emails of contributors who committed with invalid ones should be placed here. PR-URL: metarhia/jstp#88
- Loading branch information
Showing
4 changed files
with
54 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Timur Shemsedinov <timur.shemsedinov@gmail.com> | ||
Alexey Orlenko <eaglexrlnk@gmail.com> | ||
Mykola Bilochub <nbelochub@gmail.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Common utilities used by tools | ||
'use strict'; | ||
|
||
const childProcess = require('child_process'); | ||
const fs = require('fs'); | ||
|
||
const common = {}; | ||
module.exports = common; | ||
|
||
common.getCommandOutput = (cmd) => { | ||
const exec = common.promisify(childProcess.exec); | ||
return exec(cmd).then((stdout, stderr) => { | ||
if (stderr) console.error(stderr); | ||
return stdout; | ||
}); | ||
}; | ||
|
||
common.promisify = (fn) => (...args) => ( | ||
new Promise((resolve, reject) => { | ||
fn(...args, (error, ...result) => { | ||
if (error) reject(error); | ||
else resolve(...result); | ||
}); | ||
}) | ||
); | ||
|
||
common.writeFile = common.promisify(fs.writeFile); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
|
||
const path = require('path'); | ||
const { getCommandOutput, writeFile } = require('./common'); | ||
|
||
const AUTHORS_PATH = path.resolve(__dirname, '..', 'AUTHORS'); | ||
|
||
getCommandOutput('git log --reverse --format="%aN <%aE>"').then((out) => { | ||
const authors = []; | ||
for (const author of out.split('\n')) { | ||
if (!authors.includes(author)) { | ||
authors.push(author); | ||
} | ||
} | ||
return writeFile(AUTHORS_PATH, authors.join('\n')); | ||
}).catch((error) => { | ||
const message = error.stack || error.toString(); | ||
console.error(message); | ||
process.exit(1); | ||
}); |