-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(release): update contributors when publishing a release (#3552)
Grunt release publishing [used to](https://github.com/karma-runner/karma/blob/master/gruntfile.js#L103) update `contributors` in `package.json`, but this feature has been lost during the migration to `semantic-release`. This PR restores the same logic in `semantic-release` plugin. I considered using [semantic-release-contributors](https://www.npmjs.com/package/semantic-release-contributors) first, but it has couple of issues: - it only adds contributors since last release, so can not restore contributors, who were missed while semantic-release was used for publishing - it parses author data from commit and then serializes it back, which in some cases produces wrong results (e.g. David Jensen <david@frode.(none)> becomes an empty string, because parsing silently fails) Because of the above issues I've re-implemented logic from the [Grunt plugin](https://github.com/vojtajina/grunt-npm/blob/master/tasks/npm.js#L90) as a semantic-release plugin and applied changes produced by it. There are a many changes to existing contributors, because current logic sorts them by the amount of commits.
- Loading branch information
Showing
3 changed files
with
73 additions
and
38 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 |
---|---|---|
|
@@ -27,109 +27,112 @@ | |
"dignifiedquire <[email protected]>", | ||
"johnjbarton <[email protected]>", | ||
"greenkeeperio-bot <[email protected]>", | ||
"Yaroslav Admin <[email protected]>", | ||
"Karma Bot <[email protected]>", | ||
"Maksim Ryzhikov <[email protected]>", | ||
"ukasz Usarz <[email protected]>", | ||
"Yaroslav Admin <[email protected]>", | ||
"Christian Budde Christensen <[email protected]>", | ||
"taichi <[email protected]>", | ||
"Wesley Cho <[email protected]>", | ||
"semantic-release-bot <[email protected]>", | ||
"Liam Newman <[email protected]>", | ||
"lukasz <[email protected]>", | ||
"Anton <[email protected]>", | ||
"Todd Wolfson <[email protected]>", | ||
"Michał Gołębiowski-Owczarek <[email protected]>", | ||
"Mark Trostler <[email protected]>", | ||
"Ciro Nunes <[email protected]>", | ||
"Shyam Seshadri <[email protected]>", | ||
"Tim Cuthbertson <[email protected]>", | ||
"Robo <[email protected]>", | ||
"Christian Budde Christensen <[email protected]>", | ||
"Pawel Kozlowski <[email protected]>", | ||
"Christian Budde Christensen <[email protected]>", | ||
"Shyam Seshadri <[email protected]>", | ||
"Robo <[email protected]>", | ||
"Mourad <[email protected]>", | ||
"Daniel Compton <[email protected]>", | ||
"Mark Ethan Trostler <[email protected]>", | ||
"Kim Joar Bekkelund <[email protected]>", | ||
"vivganes <[email protected]>", | ||
"joshjb84 <[email protected]>", | ||
"Georgii Dolzhykov <[email protected]>", | ||
"Anton <[email protected]>", | ||
"Brian Di Palma <[email protected]>", | ||
"Nick Malaguti <[email protected]>", | ||
"Kim Joar Bekkelund <[email protected]>", | ||
"joshjb84 <[email protected]>", | ||
"David Souther <[email protected]>", | ||
"Brian Di Palma <[email protected]>", | ||
"Matthias Oßwald <[email protected]>", | ||
"Daniel Aleksandersen <[email protected]>", | ||
"Jake Champion <[email protected]>", | ||
"Marcello Nuccio <[email protected]>", | ||
"Pieter Mees <[email protected]>", | ||
"Brian Ford <[email protected]>", | ||
"Aymeric Beaumet <[email protected]>", | ||
"Andrew Martin <[email protected]>", | ||
"Iristyle <Iristyle@github>", | ||
"ywong <[email protected]>", | ||
"Chris Casola <[email protected]>", | ||
"Aymeric Beaumet <[email protected]>", | ||
"Jeff Jewiss <[email protected]>", | ||
"Pieter Mees <[email protected]>", | ||
"Jake Champion <[email protected]>", | ||
"Marcello Nuccio <[email protected]>", | ||
"Jérémy Judéaux <[email protected]>", | ||
"Andrew Martin <[email protected]>", | ||
"Brian Ford <[email protected]>", | ||
"Chris Hunt <[email protected]>", | ||
"Ilya Volodin <[email protected]>", | ||
"David Souther <[email protected]>", | ||
"pavelgj <[email protected]>", | ||
"sylvain-hamel <[email protected]>", | ||
"Ilya Volodin <[email protected]>", | ||
"ywong <[email protected]>", | ||
"Iristyle <Iristyle@github>", | ||
"Chris Hunt <[email protected]>", | ||
"Robert Stein <[email protected]>", | ||
"ngiebel <[email protected]>", | ||
"Robin Liang <[email protected]>", | ||
"rdodev <[email protected]>", | ||
"Matt Lewis <[email protected]>", | ||
"Ruben Bridgewater <[email protected]>", | ||
"Ezra Brooks <[email protected]>", | ||
"David Herges <[email protected]>", | ||
"Réda Housni Alaoui <[email protected]>", | ||
"Filipe Guerra <[email protected]>", | ||
"Aseem Bansal <[email protected]>", | ||
"Ruben Bridgewater <[email protected]>", | ||
"Bryan Smith <[email protected]>", | ||
"Sammy Jelin <sjelin@gmail.com>", | ||
"Réda Housni Alaoui <reda.housnialaoui@gmail.com>", | ||
"David Pärsson <[email protected]>", | ||
"Sergei Startsev <[email protected]>", | ||
"Sammy Jelin <[email protected]>", | ||
"Jonas Pommerening <[email protected]>", | ||
"Sergei Startsev <[email protected]>", | ||
"Sergey Simonchik <[email protected]>", | ||
"Sergey Simonchik <[email protected]>", | ||
"Shane Russell <[email protected]>", | ||
"Jonathan Freeman <[email protected]>", | ||
"Josh <[email protected]>", | ||
"Bulat Shakirzyanov <[email protected]>", | ||
"Shane Russell <[email protected]>", | ||
"Josh <[email protected]>", | ||
"Andrew Morris <[email protected]>", | ||
"Greenkeeper <[email protected]>", | ||
"Stefan Dragnev <[email protected]>", | ||
"Steve Mao <[email protected]>", | ||
"Steve Mao <[email protected]>", | ||
"Steve Van Opstal <[email protected]>", | ||
"Sylvain Hamel <[email protected]>", | ||
"KJ Tsanaktsidis <[email protected]>", | ||
"Nico Jansen <[email protected]>", | ||
"Terry <[email protected]>", | ||
"Andrew Morris <[email protected]>", | ||
"Cyrus Chan <[email protected]>", | ||
"Thomas Parisot <[email protected]>", | ||
"Hugues Malphettes <[email protected]>", | ||
"Tom Erik Støwer <[email protected]>", | ||
"Thomas Parisot <[email protected]>", | ||
"Igor Minar <[email protected]>", | ||
"Keen Yee Liau <[email protected]>", | ||
"Igor Minar <[email protected]>", | ||
"Tom Erik Støwer <[email protected]>", | ||
"Kelly Jensen <[email protected]>", | ||
"Ilya Goncharov <[email protected]>", | ||
"Kevin Huang <[email protected]>", | ||
"Kevin WENNER <[email protected]>", | ||
"Parashuram <[email protected]>", | ||
"Vivek Ganesan <[email protected]>", | ||
"Vladimir Starkov <[email protected]>", | ||
"Pat Tullmann <[email protected]>", | ||
"Kevin WENNER <kevin.wenner@massmotionmedia.com>", | ||
"ChangZhuo Chen (陳昌倬) <czchen@gmail.com>", | ||
"PatrickJS <[email protected]>", | ||
"Levi Thomason <[email protected]>", | ||
"ChangZhuo Chen (陳昌倬) <[email protected]>", | ||
"comdiv <[email protected]>", | ||
"Aseem Bansal <[email protected]>", | ||
"Luke Page <[email protected]>", | ||
"comdiv <[email protected]>", | ||
"James Ford <[email protected]>", | ||
"James Talmage <[email protected]>", | ||
"DarthCharles <[email protected]>", | ||
"Richard Harrington <[email protected]>", | ||
"karmarunnerbot <[email protected]>", | ||
"DarthCharles <[email protected]>", | ||
"Roarke Gaskill <[email protected]>", | ||
"Ethan J. Brown <[email protected]>", | ||
"Ezra Brooks <[email protected]>", | ||
"Roarke Gaskill <[email protected]>", | ||
"Matt Lewis <[email protected]>", | ||
"David Herges <[email protected]>", | ||
"Karol Fabjańczuk <[email protected]>", | ||
"Karolis Narkevicius <[email protected]>", | ||
"Keats <[email protected]>", | ||
|
@@ -144,6 +147,7 @@ | |
"M1xA <[email protected]>", | ||
"Magnus Markling <[email protected]>", | ||
"Manfred Stock <[email protected]>", | ||
"Manoel <[email protected]>", | ||
"Marko Anastasov <[email protected]>", | ||
"Martin Geisler <[email protected]>", | ||
"Martin Jul <[email protected]>", | ||
|
@@ -156,6 +160,7 @@ | |
"Matthias Oßwald <[email protected]>", | ||
"Matti Paksula <[email protected]>", | ||
"Mattijs Kneppers <[email protected]>", | ||
"Max Waterman <[email protected]>", | ||
"Merott Movahedi <[email protected]>", | ||
"Merrick Christensen <[email protected]>", | ||
"Michael Krotscheck <[email protected]>", | ||
|
@@ -170,9 +175,9 @@ | |
"Nick McCurdy <[email protected]>", | ||
"Nick Payne <[email protected]>", | ||
"Nick Williams <[email protected]>", | ||
"Nico Jansen <[email protected]>", | ||
"Nicolas Artman <[email protected]>", | ||
"Nicolas Ferrero <[email protected]>", | ||
"Nikita Balakirev <[email protected]>", | ||
"Nir Moav <[email protected]>", | ||
"Nish <[email protected]>", | ||
"Nuno Job <[email protected]>", | ||
|
@@ -198,6 +203,7 @@ | |
"Peter Yates <[email protected]>", | ||
"Philip Harrison <[email protected]>", | ||
"Pierre Vanduynslager <[email protected]>", | ||
"Piotr Błażejewicz (Peter Blazejewicz) <[email protected]>", | ||
"Piper Chester <[email protected]>", | ||
"Rafal Lindemann <[email protected]>", | ||
"Remy Sharp <[email protected]>", | ||
|
@@ -234,6 +240,8 @@ | |
"Thai Pangsakulyanont @ Taskworld <[email protected]>", | ||
"Thijs Triemstra <[email protected]>", | ||
"Thomas Parisot <[email protected]>", | ||
"Tim Gates <[email protected]>", | ||
"Tim Hartman <[email protected]>", | ||
"Tim Olshansky <[email protected]>", | ||
"Timo Tijhof <[email protected]>", | ||
"Tom MacWright <[email protected]>", | ||
|
@@ -289,6 +297,7 @@ | |
"Alexander Pepper <[email protected]>", | ||
"Alexander Shtuchkin <[email protected]>", | ||
"Alexei <[email protected]>", | ||
"Ameer Jhan <[email protected]>", | ||
"Anders Ekdahl <[email protected]>", | ||
"Anders Janmyr <[email protected]>", | ||
"Andreas Krummsdorf <[email protected]>", | ||
|
@@ -305,6 +314,7 @@ | |
"Basemm <[email protected]>", | ||
"Benoit Charbonnier <[email protected]>", | ||
"Bhavesh Kakadiya <[email protected]>", | ||
"Borewit <[email protected]>", | ||
"Brady Wied <[email protected]>", | ||
"Bram Borggreve <[email protected]>", | ||
"Breno Calazans <[email protected]>", | ||
|
@@ -321,6 +331,7 @@ | |
"Chris Dawson <[email protected]>", | ||
"Christian Weiss <[email protected]>", | ||
"Christopher Hiller <[email protected]>", | ||
"Chuf <[email protected]>", | ||
"Ciro S. Costa <[email protected]>", | ||
"Daan Stolp <[email protected]>", | ||
"Damien Choizit <[email protected]>", | ||
|
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,23 @@ | ||
const { execSync } = require('child_process') | ||
const { readFileSync, writeFileSync } = require('fs') | ||
const { resolve } = require('path') | ||
|
||
const prepare = async (pluginConfig, { logger }) => { | ||
// Example output: | ||
// 1042 Vojta Jina <[email protected]> | ||
// 412 Friedel Ziegelmayer <[email protected]> | ||
// 206 dignifiedquire <[email protected]> | ||
// 139 johnjbarton <[email protected]> | ||
const stdout = execSync('git log --pretty=short | git shortlog -nse', { encoding: 'utf8' }) | ||
|
||
const pkgPath = resolve(__dirname, '..', 'package.json') | ||
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) | ||
|
||
// First line is already included as author field. Last line is dropped as it is an empty line. | ||
pkg.contributors = stdout.split('\n').slice(1, -1).map((line) => line.replace(/^[\W\d]+/, '')) | ||
writeFileSync(pkgPath, JSON.stringify(pkg, undefined, ' ') + '\n', 'utf8') | ||
|
||
logger.info('Updated contributors list.') | ||
} | ||
|
||
module.exports = { prepare } |