Skip to content

Commit

Permalink
remove contributors from package.json in favour of AUTHORS (#1774)
Browse files Browse the repository at this point in the history
* remove contributors from package.json in favour of AUTHORS

The contributors section of our package.json is _very_ long and
manually updating can (?) be a pain.

I took a leaf out of nodejs's book and copied their update-authors
script [1].

[1]: https://github.com/nodejs/node/blob/master/tools/update-authors.js

* remove some of my many emails

* add a couple more mail mappings

* get lint passing

* add instruction to update-authors

Co-authored-by: Jos de Jong <[email protected]>
  • Loading branch information
harrysarson and josdejong authored Mar 23, 2020
1 parent 1dbae6e commit 08feb7f
Show file tree
Hide file tree
Showing 5 changed files with 274 additions and 99 deletions.
28 changes: 28 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Bartosz Leoniak <[email protected]>
Benjamin Lucas <[email protected]>
Eric Mansfield <[email protected]>
Finn Pauls <[email protected]>
Gary Passero <[email protected]>
Harsh Gupta <w327AJUdMV2yGVq5dkNX>
Karl Lew <[email protected]>
Horatiu Lazu <[email protected]>
Michael M. <[email protected]>
Oleg <[email protected]>
Pat Grasso <[email protected]>
Saket Saurabh <[email protected]>
Sathish Kumar Subramani <[email protected]>
Slava Ganzin <[email protected]>
Stu Blair <[email protected]>
Harry Sarson <[email protected]> H.D. Sarson <[email protected]>
<[email protected]> <[email protected]>
<[email protected]> <[email protected]>
<[email protected]> <[email protected]>
Timothy Lee <[email protected]>
Tóth Róbert <[email protected]>
Todd Morse <[email protected]>
<[email protected]> <[email protected]>
Rogelio J. Baucells <[email protected]> rjbaucells <[email protected]>
<[email protected]> <[email protected]>
<[email protected]> <[email protected]>
Paulo Buchsbaum <[email protected]>
<[email protected]> <[email protected]>
132 changes: 132 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Authors ordered by first contribution.

Jos de Jong <[email protected]>
Bart Kiers <[email protected]>
Bryan Cuccioli <[email protected]>
Zak Zibrat <[email protected]>
Jim Garrison <[email protected]>
Sebastien Piquemal <[email protected]>
Guillermo Indalecio <[email protected]>
Waldir Pimenta <[email protected]>
Elijah Insua <[email protected]>
Marcus André <[email protected]>
Daniel Levin <[email protected]>
hama_du <[email protected]>
Finn Pauls <[email protected]>
Matt Traynham <[email protected]>
Fabrice Colas <[email protected]>
Rogelio J. Baucells <[email protected]>
Niels Heisterkamp <[email protected]>
Mitchel Kelonye <[email protected]>
Pavel Panchekha <[email protected]>
Owen Versteeg <[email protected]>
Andy Pan <[email protected]>
Ryan Seys <[email protected]>
Favian Contreras <[email protected]>
Kenan Yildirim <[email protected]>
Pete Corey <[email protected]>
Max Bruckner <[email protected]>
Ole Kröger <[email protected]>
J. Harshbarger <[email protected]>
James Herdman <[email protected]>
Nick Foti <[email protected]>
Devan Patel <[email protected]>
Kunal Vyas <[email protected]>
Liam Newman <[email protected]>
Alex Edgcomb <[email protected]>
Ganga Christopher <[email protected]>
Ubuntu <[email protected]>
Sergey Romanov <[email protected]>
Eric Mansfield <[email protected]>
Veaceslav Grimalschi <[email protected]>
Holman Gao <[email protected]>
Robert Eisele <[email protected]>
Tomek Wiszniewski <[email protected]>
Ben Nelson <[email protected]>
devdevdata222 <[email protected]>
David Simons <[email protected]>
john marinelli <[email protected]>
paulmasson <[email protected]>
Keunhong Park <[email protected]>
Brett Jurgens <[email protected]>
oyvindjam <[email protected]>
Harsh Gupta <w327AJUdMV2yGVq5dkNX>
Stu Blair <[email protected]>
Priidik Vaikla <[email protected]>
Mathias Polligkeit <[email protected]>
Horatiu Lazu <[email protected]>
Thomas Brierley <[email protected]>
Ekin Koc <[email protected]>
Pat Grasso <[email protected]>
Adam Butler <[email protected]>
Timothy Lee <[email protected]>
woylie <[email protected]>
Harry Sarson <[email protected]>
Sebastian Ruhleder <[email protected]>
Maxired (Maxence Dalmais) <[email protected]>
Adam Kelly <[email protected]>
Troy Alford <[email protected]>
Todd Morse <[email protected]>
Dzmitry Litskalau <[email protected]>
Max Kramer <[email protected]>
Slava Ganzin <[email protected]>
Gulfaraz Yasin <[email protected]>
Tóth Róbert <[email protected]>
Victor <[email protected]>
viclai <[email protected]>
PJ Hampton <[email protected]>
Alexander Beyn <[email protected]>
Vincent Lee <[email protected]>
Karl Lew <[email protected]>
mocking <[email protected]>
Michael M. <[email protected]>
Ivan Vergiliev <[email protected]>
Paulo Buchsbaum <[email protected]>
jeffreyshen19 <[email protected]>
Oleg <[email protected]>
Joel Hoover <[email protected]>
denisx <[email protected]>
Clément P <[email protected]>
jean-emmanuel <[email protected]>
pokeball99 <[email protected]>
Robin Wieruch <[email protected]>
Dakota Blair <[email protected]>
Henrique Ferrolho <[email protected]>
Jack Schmidt <[email protected]>
Daniel Ruf <[email protected]>
Saket Saurabh <[email protected]>
Gary Passero <[email protected]>
Chris Chudzicki <[email protected]>
Daniel Kostro <[email protected]>
Ben Weinshel <[email protected]>
Honeybar <[email protected]>
Amin Abdul Manaf <[email protected]>
Jason Shin <[email protected]>
Mathias Rasmussen <[email protected]>
Sathish Kumar Subramani <[email protected]>
dkenul <[email protected]>
Gold Holk <[email protected]>
Benjamin Lucas <[email protected]>
Albert Emil <[email protected]>
Maximilian <[email protected]>
Rian McGuire <[email protected]>
Jack Mason <[email protected]>
SzechuanSage <[email protected]>
sam-19 <[email protected]>
Chris Hadgis <[email protected]>
Jackie Han <[email protected]>
Kevin J <[email protected]>
Vlad Levitskiy <[email protected]>
Tom MacWright <[email protected]>
0xflotus <[email protected]>
Waseem Yusuf <[email protected]>
Tanmay <[email protected]>
Clinton Curry <[email protected]>
Arthur Guiot <[email protected]>
Bartosz Leoniak <[email protected]>
Veeloxfire <[email protected]>
Arkajit Mandal <[email protected]>
David Bramwell <[email protected]>
Cameron Tacklind <[email protected]>

# Generated by tools/update-authors.js
7 changes: 7 additions & 0 deletions misc/how_to_publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ Update the date and version number in the file `HISTORY.md`. Verify whether all
changes in the new version are described.


## Update authors

Run:

npm run update-authors


## Build and test

Build the distribution files in folders `dist` and `lib`, and test everything by running:
Expand Down
101 changes: 2 additions & 99 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,104 +3,6 @@
"version": "6.6.1",
"description": "Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.",
"author": "Jos de Jong <[email protected]> (https://github.com/josdejong)",
"contributors": [
"Adam Kelly (https://github.com/adamisntdead)",
"Albert Emil (https://github.com/AlbertEmil)",
"Alexander Beyn (https://github.com/AlexanderBeyn)",
"Andy Pan (https://github.com/andy0130tw)",
"Arkajit Mandal (https://github.com/arkajitmandal)",
"Arthur Guiot (https://github.com/arguiot)",
"Bart Kiers (https://github.com/bkiers)",
"Bartosz Leoniak (https://github.com/kmdrGroch)",
"Ben Weinshel (https://github.com/weinshel)",
"Benjamin Lucas (https://github.com/bnlcas)",
"Brett Jurgens (https://github.com/brettjurgens)",
"Bryan Cuccioli (https://github.com/bcuccioli)",
"Cameron Tacklind (https://github.com/cinderblock)",
"Chris Chudzicki (https://github.com/ChristopherChudzicki)",
"Chris Hadgis (https://github.com/SzechuanSage)",
"Clinton Curry (https://github.com/clintonc)",
"Dakota Blair (https://github.com/dakotablair)",
"David Bramwell (https://github.com/dbramwell)",
"Daniel Kostro (https://github.com/stropitek)",
"Daniel Levin (https://github.com/daniel-levin)",
"David Simons (https://github.com/SwamWithTurtles)",
"denisx (https://github.com/denisx)",
"dkenul (https://github.com/dkenul)",
"Devan Patel (https://github.com/devanp92)",
"devdevdata222 (https://github.com/devdevdata222)",
"Dzmitry Litskalau (https://github.com/litmit)",
"Ekin Koc (https://github.com/eknkc)",
"Elijah Insua (https://github.com/tmpvar)",
"Eric Mansfield (https://github.com/ericman314)",
"Fabrice Colas (https://github.com/fabricecolas)",
"Favian Contreras (https://github.com/BigFav)",
"Finn Pauls (https://github.com/finnp)",
"Ganga Christopher (https://github.com/gangachris)",
"Gary Passero (https://github.com/gap777)",
"Gold Holk (https://github.com/GHolk)",
"Harry Sarson (https://github.com/HarrySarson)",
"Holman Gao (https://github.com/golmansax)",
"Honybar (https://github.com/honeybar)",
"Guillermo Indalecio Fernández (https://github.com/guillermobox)",
"Gulfaraz (https://github.com/gulfaraz)",
"hamadu (https://github.com/hamadu)",
"Harsh Gupta (https://github.com/hgupta9)",
"Henrique Ferrolho (https://github.com/ferrolho)",
"Huseyn Guliyev (https://github.com/husayt)",
"Ivan Vergiliev (IvanVergiliev)",
"jean-emmanuel (https://github.com/jean-emmanuel)",
"Jack Schmidt (https://github.com/jackschmidt)",
"Jackie Han (https://github.com/hanguokai)",
"Jason Shin (https://github.com/JasonShin)",
"Jim Garrison (https://github.com/garrison)",
"Joel Hoover (https://github.com/joelhoover)",
"Karl Lew (https://github.com/firepick1)",
"Kenan Yildirim (https://github.com/KenanY)",
"Keunhong Park (https://github.com/void42)",
"Keunhong Park (https://github.com/kevjin)",
"Kevin J (https://github.com/kv-kunalvyas)",
"Marcus Andre (https://github.com/marcusandre)",
"Horatiu Lazu (https://github.com/MathBunny)",
"Mathias Polligkeit (https://github.com/woylie)",
"Mathias Rasmussen (https://github.com/mathiasvr)",
"Max Bruckner (https://github.com/FSMaxB)",
"Maxence Dalmais (https://github.com/maxired)",
"Michael M. (https://github.com/Schnark)",
"Mitchel Kelonye (https://github.com/kelonye)",
"mtraynham (https://github.com/mtraynham)",
"Niels Heisterkamp (https://github.com/nheisterkamp)",
"Oleg (https://github.com/ovk)",
"Owen Versteeg (https://github.com/owenversteeg)",
"Pavel Panchekha (https://github.com/pavpanchekha)",
"Pat Grasso (https://github.com/patgrasso)",
"Paulo Buchsbaum (https://github.com/paulobuchsbaum)",
"Pete Corey (https://github.com/pcorey)",
"PJ Hampton (https://github.com/pjhampton )",
"Retsam (https://github.com/Retsam)",
"Rian McGuire (https://github.com/rianmcguire)",
"Robert Eisele (https://github.com/infusion)",
"Rogelio J. Baucells (https://github.com/rjbaucells)",
"Ryan Seys (https://github.com/ryanseys)",
"Saket Saurabh (https://github.com/ssaket)",
"Sathish Kumar Subramani (https://github.com/Sathish-kumar-Subramani )",
"Sebastien Piquemal (https://github.com/sebpiq)",
"Sebastian Ruhleder (https://github.com/ruhleder)",
"Sergey Romanov (https://github.com/saromanov)",
"Slava Ganzin (https://github.com/slavaGanzin)",
"Stu Blair (https://github.com/stu-blair)",
"Tanmay (https://github.com/maytanthegeek)",
"Thomas Brierley (https://github.com/ThomasBrierley)",
"Timothy Lee (https://github.com/tetslee)",
"Tom MacWright (https://github.com/tmcw)",
"Tóth Róbert (https://github.com/Nekomajin42)",
"Todd Morse (https://github.com/morsecodist)",
"Veeloxfire (https://github.com/Veeloxfire)",
"Vlad Levitskiy (https://github.com/mcvladthegoat)",
"Waldir Pimenta (https://github.com/waldyrious)",
"Waseem Yusuf (https://github.com/waseemyusuf)",
"Zach Zibrat (https://github.com/palimpsests)"
],
"homepage": "https://mathjs.org",
"repository": {
"type": "git",
Expand Down Expand Up @@ -211,7 +113,8 @@
"test:browserstack": "karma start test/browser-test-config/browserstack-karma.js",
"coverage": "nyc --reporter=lcov --reporter=text-summary mocha test/unit-tests --recursive --require @babel/register && echo \"\nDetailed coverage report is available at ./coverage/lcov-report/index.html\"",
"prepublishOnly": "npm run test:all && npm run lint",
"prepare": "npm run build"
"prepare": "npm run build",
"update-authors": "node ./tools/update-authors.js"
},
"bin": {
"mathjs": "./bin/cli.js"
Expand Down
105 changes: 105 additions & 0 deletions tools/update-authors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/usr/bin/env node

// Attribution:
// This file is based on https://github.com/nodejs/node/blob/master/tools/update-authors.js.
// It is licensed according to https://github.com/nodejs/node/blob/master/LICENSE

// Usage: tools/update-author.js [--dry]
// Passing --dry will redirect output to stdout rather than write to 'AUTHORS'.

'use strict'
const { spawn } = require('child_process')
const path = require('path')
const fs = require('fs')
const readline = require('readline')

class CaseIndifferentMap {
constructor () {
this._map = new Map()
}

get (key) { return this._map.get(key.toLowerCase()) }
set (key, value) { return this._map.set(key.toLowerCase(), value) }
}

const log = spawn(
'git',
// Inspect author name/email and body.
['log', '--reverse', '--format=Author: %aN <%aE>\n%b'], {
stdio: ['inherit', 'pipe', 'inherit']
})
const rl = readline.createInterface({ input: log.stdout })

let output
if (process.argv.includes('--dry')) { output = process.stdout } else { output = fs.createWriteStream('AUTHORS') }

output.write('# Authors ordered by first contribution.\n\n')

const mailmap = new CaseIndifferentMap()
{
const lines = fs.readFileSync(path.resolve(__dirname, '../', '.mailmap'),
{ encoding: 'utf8' }).split('\n')
for (let line of lines) {
line = line.trim()
if (line.startsWith('#') || line === '') continue

// Replaced Name <[email protected]>
const match1 = line.match(/^([^<]+)\s+(<[^>]+>)$/)
if (match1) {
mailmap.set(match1[2], { author: match1[1] })
continue
}
// <[email protected]> <[email protected]>
const match2 = line.match(/^<([^>]+)>\s+(<[^>]+>)$/)
if (match2) {
mailmap.set(match2[2], { email: match2[1] })
continue
}
// Replaced Name <[email protected]> <[email protected]>
const match3 = line.match(/^([^<]+)\s+(<[^>]+>)\s+(<[^>]+>)$/)
if (match3) {
mailmap.set(match3[3], {
author: match3[1], email: match3[2]
})
continue
}
// Replaced Name <[email protected]> Original Name <[email protected]>
const match4 = line.match(/^([^<]+)\s+(<[^>]+>)\s+([^<]+)\s+(<[^>]+>)$/)
if (match4) {
mailmap.set(match4[3] + '\0' + match4[4], {
author: match4[1], email: match4[2]
})
continue
}
console.warn('Unknown .mailmap format:', line)
}
}

const seen = new Set()

// Support regular git author metadata, as well as `Author:` and
// `Co-authored-by:` in the message body. Both have been used in the past
// to indicate multiple authors per commit, with the latter standardized
// by GitHub now.
const authorRe =
/(^Author:|^Co-authored-by:)\s+(?<author>[^<]+)\s+(?<email><[^>]+>)/i
rl.on('line', (line) => {
const match = line.match(authorRe)
if (!match) return

const { author, email } = match.groups

if (seen.has(email) ||
/@chromium\.org/.test(email) ||
/greenkeeper\[bot\]/.test(email) ||
email === '<[email protected]>') {
return
}

seen.add(email)
output.write(`${author} ${email}\n`)
})

rl.on('close', () => {
output.end('\n# Generated by tools/update-authors.js\n')
})

0 comments on commit 08feb7f

Please sign in to comment.