Skip to content

Commit af79c99

Browse files
authored
Build: migrate grunt authors to a custom script
- the new script pulls all authors from the Sizzle repo - added temporary grunt task for releases Close gh-5395
1 parent 88690eb commit af79c99

File tree

5 files changed

+146
-26
lines changed

5 files changed

+146
-26
lines changed

AUTHORS.txt

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Michael Bensoussan <mickey@seesmic.com>
3131
Louis-Rémi Babé <lrbabe@gmail.com>
3232
Robert Katić <robert.katic@gmail.com>
3333
Damian Janowski <damian.janowski@gmail.com>
34-
Anton Kovalyov <anton@kovalyov.net>
3534
Dušan B. Jovanovic <dbjdbj@gmail.com>
3635
Earle Castledine <mrspeaker@gmail.com>
3736
Rich Dougherty <rich@rd.gen.nz>
@@ -69,11 +68,11 @@ temp01 <temp01irc@gmail.com>
6968
Colin Snover <github.com@zetafleet.com>
7069
Jared Grippe <jared@deadlyicon.com>
7170
Ryan W Tenney <ryan@10e.us>
72-
Alex Sexton <AlexSexton@gmail.com>
7371
Pinhook <contact@pinhooklabs.com>
7472
Ron Otten <r.j.g.otten@gmail.com>
7573
Jephte Clain <Jephte.Clain@univ-reunion.fr>
7674
Anton Matzneller <obhvsbypqghgc@gmail.com>
75+
Alex Sexton <AlexSexton@gmail.com>
7776
Dan Heberden <danheberden@gmail.com>
7877
Henri Wiechers <hwiechers@gmail.com>
7978
Russell Holbrook <russell.holbrook@patch.com>
@@ -87,9 +86,10 @@ Sylvester Keil <sylvester@keil.or.at>
8786
Brandon Sterne <bsterne@mozilla.com>
8887
Mathias Bynens <mathias@qiwi.be>
8988
Lee Carpenter <elcarpie@gmail.com>
90-
Timmy Willison <4timmywil@gmail.com>
89+
Timmy Willison <timmywil@users.noreply.github.com>
9190
Corey Frang <gnarf37@gmail.com>
9291
Digitalxero <digitalxero>
92+
Anton Kovalyov <anton@kovalyov.net>
9393
David Murdoch <david@davidmurdoch.com>
9494
Josh Varner <josh.varner@gmail.com>
9595
Charles McNulty <cmcnulty@kznf.com>
@@ -111,7 +111,7 @@ Mike Sherov <mike.sherov@gmail.com>
111111
Greg Hazel <ghazel@gmail.com>
112112
Schalk Neethling <schalk@ossreleasefeed.com>
113113
Denis Knauf <Denis.Knauf@gmail.com>
114-
Timo Tijhof <krinklemail@gmail.com>
114+
Timo Tijhof <krinkle@fastmail.com>
115115
Steen Nielsen <swinedk@gmail.com>
116116
Anton Ryzhov <anton@ryzhov.me>
117117
Shi Chuan <shichuanr@gmail.com>
@@ -151,7 +151,6 @@ Chris Faulkner <thefaulkner@gmail.com>
151151
Marcel Greter <marcel.greter@ocbnet.ch>
152152
Elijah Manor <elijah.manor@gmail.com>
153153
Daniel Chatfield <chatfielddaniel@gmail.com>
154-
Daniel Gálvez <dgalvez@editablething.com>
155154
Nikita Govorov <nikita.govorov@gmail.com>
156155
Wesley Walser <waw325@gmail.com>
157156
Mike Pennisi <mike@mikepennisi.com>
@@ -162,9 +161,7 @@ Dave Riddle <david@joyvuu.com>
162161
Callum Macrae <callum@lynxphp.com>
163162
Jonathan Sampson <jjdsampson@gmail.com>
164163
Benjamin Truyman <bentruyman@gmail.com>
165-
Jay Merrifield <fracmak@gmail.com>
166164
James Huston <james@jameshuston.net>
167-
Sai Lung Wong <sai.wong@huffingtonpost.com>
168165
Erick Ruiz de Chávez <erickrdch@gmail.com>
169166
David Bonner <dbonner@cogolabs.com>
170167
Allen J Schmidt Jr <cobrasoft@gmail.com>
@@ -174,8 +171,11 @@ Ismail Khair <ismail.khair@gmail.com>
174171
Carl Danley <carldanley@gmail.com>
175172
Mike Petrovich <michael.c.petrovich@gmail.com>
176173
Greg Lavallee <greglavallee@wapolabs.com>
174+
Daniel Gálvez <dgalvez@editablething.com>
175+
Sai Lung Wong <sai.wong@huffingtonpost.com>
177176
Tom H Fuertes <TomFuertes@gmail.com>
178177
Roland Eckl <eckl.roland@googlemail.com>
178+
Jay Merrifield <fracmak@gmail.com>
179179
Yiming He <yiminghe@gmail.com>
180180
David Fox <dfoxinator@gmail.com>
181181
Bennett Sorbo <bsorbo@gmail.com>
@@ -192,17 +192,16 @@ Diego Tres <diegotres@gmail.com>
192192
Jean Boussier <jean.boussier@gmail.com>
193193
Andrew Plummer <plummer.andrew@gmail.com>
194194
Mark Raddatz <mraddatz@gmail.com>
195-
Pascal Borreli <pascal@borreli.com>
196195
Isaac Z. Schlueter <i@izs.me>
197196
Karl Sieburg <ksieburg@yahoo.com>
197+
Pascal Borreli <pascal@borreli.com>
198198
Nguyen Phuc Lam <ruado1987@gmail.com>
199199
Dmitry Gusev <dmitry.gusev@gmail.com>
200200
Steven Benner <admin@stevenbenner.com>
201201
Li Xudong <istonelee@gmail.com>
202202
Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
203203
Renato Oliveira dos Santos <ros3@cin.ufpe.br>
204204
Frederic Junod <frederic.junod@camptocamp.com>
205-
Tom H Fuertes <tomfuertes@gmail.com>
206205
Mitch Foley <mitch@thefoley.net>
207206
ros3cin <ros3@cin.ufpe.br>
208207
Kyle Robinson Young <kyle@dontkry.com>
@@ -250,7 +249,6 @@ Dan Hart <danhart@notonthehighstreet.com>
250249
Nazar Mokrynskyi <nazar@mokrynskyi.com>
251250
Benjamin Tan <demoneaux@gmail.com>
252251
Amit Merchant <bullredeyes@gmail.com>
253-
Jason Bedard <jason+github@jbedard.ca>
254252
Veaceslav Grimalschi <grimalschi@yandex.ru>
255253
Richard McDaniel <rm0026@uah.edu>
256254
Arthur Verschaeve <contact@arthurverschaeve.be>
@@ -273,12 +271,12 @@ Jon Hester <jon.d.hester@gmail.com>
273271
Colin Frick <colin@bash.li>
274272
Winston Howes <winstonhowes@gmail.com>
275273
Alexander O'Mara <me@alexomara.com>
276-
Chris Rebert <github@rebertia.com>
277274
Bastian Buchholz <buchholz.bastian@googlemail.com>
278275
Mu Haibao <mhbseal@163.com>
279276
Calvin Metcalf <calvin.metcalf@gmail.com>
280277
Arthur Stolyar <nekr.fabula@gmail.com>
281278
Gabriel Schulhof <gabriel.schulhof@intel.com>
279+
Chris Rebert <github@rebertia.com>
282280
Gilad Peleg <giladp007@gmail.com>
283281
Julian Alexander Murillo <julian.alexander.murillo@gmail.com>
284282
Kevin Kirsche <Kev.Kirsche+GitHub@gmail.com>
@@ -297,15 +295,14 @@ Christian Grete <webmaster@christiangrete.com>
297295
Tom von Clef <thomas.vonclef@gmail.com>
298296
Liza Ramo <liza.h.ramo@gmail.com>
299297
Joelle Fleurantin <joasqueeniebee@gmail.com>
300-
Steve Mao <maochenyan@gmail.com>
301298
Jon Dufresne <jon.dufresne@gmail.com>
302299
Jae Sung Park <alberto.park@gmail.com>
303300
Josh Soref <apache@soref.com>
304-
Saptak Sengupta <saptak013@gmail.com>
305301
Henry Wong <henryw4k@gmail.com>
306302
Jun Sun <klsforever@gmail.com>
307303
Martijn W. van der Lee <martijn@vanderlee.com>
308304
Devin Wilson <dwilson6.github@gmail.com>
305+
Steve Mao <maochenyan@gmail.com>
309306
Damian Senn <jquery@topaxi.codes>
310307
Zack Hall <zackhall@outlook.com>
311308
Vitaliy Terziev <vitaliyterziev@gmail.com>
@@ -336,6 +333,7 @@ Jordan Beland <jordan.beland@gmail.com>
336333
Henry Zhu <hi@henryzoo.com>
337334
Nilton Cesar <niltoncms@gmail.com>
338335
basil.belokon <basil.belokon@gmail.com>
336+
Saptak Sengupta <saptak013@gmail.com>
339337
Andrey Meshkov <ay.meshkov@gmail.com>
340338
tmybr11 <tomas.perone@gmail.com>
341339
Luis Emilio Velasco Sanchez <emibloque@gmail.com>
@@ -344,14 +342,32 @@ Bert Zhang <enbo@users.noreply.github.com>
344342
Sébastien Règne <regseb@users.noreply.github.com>
345343
wartmanm <3869625+wartmanm@users.noreply.github.com>
346344
Siddharth Dungarwal <sd5869@gmail.com>
347-
abnud1 <ahmad13932013@hotmail.com>
348345
Andrei Fangli <andrei_fangli@outlook.com>
349346
Marja Hölttä <marja.holtta@gmail.com>
347+
abnud1 <ahmad13932013@hotmail.com>
350348
buddh4 <mail@jharrer.de>
351349
Hoang <dangkyokhoang@gmail.com>
350+
Sean Robinson <sean.robinson@scottsdalecc.edu>
352351
Wonseop Kim <wonseop.kim@samsung.com>
353352
Pat O'Callaghan <patocallaghan@gmail.com>
354353
JuanMa Ruiz <ruizjuanma@gmail.com>
355354
Ahmed.S.ElAfifi <ahmed.s.elafifi@gmail.com>
356-
Sean Robinson <sean.robinson@scottsdalecc.edu>
357355
Christian Oliff <christianoliff@pm.me>
356+
Christian Wenz <christian@wenz.org>
357+
Jonathan <vanillajonathan@users.noreply.github.com>
358+
Ed Sanders <ejsanders@gmail.com>
359+
Pierre Grimaud <grimaud.pierre@gmail.com>
360+
Beatriz Rezener <beatrizrezener@users.noreply.github.com>
361+
Necmettin Karakaya <necmettin.karakaya@gmail.com>
362+
Wonhyoung Park <wh05.park@samsung.com>
363+
Dallas Fraser <dallas.fraser.waterloo@gmail.com>
364+
高灰 <www@zeroplace.cn>
365+
fecore1 <89127124+fecore1@users.noreply.github.com>
366+
ygj6 <7699524+ygj6@users.noreply.github.com>
367+
Bruno PIERRE <brunopierre4@yahoo.fr>
368+
Simon Legner <Simon.Legner@gmail.com>
369+
Baoshuo Ren <i@baoshuo.ren>
370+
Anders Kaseorg <andersk@mit.edu>
371+
Alex <aleksandrosansan@gmail.com>
372+
Gabriela Gutierrez <gabigutierrez@google.com>
373+
Dimitri Papadopoulos Orfanos <3234522+DimitriPapadopoulos@users.noreply.github.com>

Gruntfile.cjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,14 @@ module.exports = function( grunt ) {
209209
grunt.log.writeln( "Node.js 17 or newer detected, skipping jsdom tests..." );
210210
} );
211211

212+
grunt.registerTask( "authors", async function() {
213+
const done = this.async();
214+
const { getAuthors } = require( "./build/release/authors.js" );
215+
const authors = await getAuthors();
216+
console.log( authors.join( "\n" ) );
217+
done();
218+
} );
219+
212220
grunt.registerTask( "test:jsdom", [
213221

214222
// Support: Node.js 17+

build/release/authors.js

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
"use strict";
2+
3+
const fs = require( "node:fs" );
4+
const util = require( "node:util" );
5+
const exec = util.promisify( require( "node:child_process" ).exec );
6+
const rnewline = /\r?\n/;
7+
const rdate = /^\[(\d+)\] /;
8+
9+
const ignore = [
10+
/dependabot\[bot\]/
11+
];
12+
13+
function compareAuthors( a, b ) {
14+
const aName = a.replace( rdate, "" ).replace( / <.*>/, "" );
15+
const bName = b.replace( rdate, "" ).replace( / <.*>/, "" );
16+
return aName === bName;
17+
}
18+
19+
function uniq( arr ) {
20+
const unique = [];
21+
for ( const item of arr ) {
22+
if ( ignore.some( re => re.test( item ) ) ) {
23+
continue;
24+
}
25+
if ( item && !unique.find( ( e ) => compareAuthors( e, item ) ) ) {
26+
unique.push( item );
27+
}
28+
}
29+
return unique;
30+
}
31+
32+
function cleanupSizzle() {
33+
console.log( "Cleaning up..." );
34+
return exec( "npx rimraf .sizzle" );
35+
}
36+
37+
function cloneSizzle() {
38+
console.log( "Cloning Sizzle..." );
39+
return exec( "git clone https://github.com/jquery/sizzle .sizzle" );
40+
}
41+
42+
async function getLastAuthor() {
43+
const authorsTxt = await fs.promises.readFile( "AUTHORS.txt", "utf8" );
44+
return authorsTxt.trim().split( rnewline ).pop();
45+
}
46+
47+
async function logAuthors( preCommand ) {
48+
let command = "git log --pretty=format:\"[%at] %aN <%aE>\"";
49+
if ( preCommand ) {
50+
command = `${ preCommand } && ${ command }`;
51+
}
52+
const { stdout } = await exec( command );
53+
return uniq( stdout.trim().split( rnewline ).reverse() );
54+
}
55+
56+
async function getSizzleAuthors() {
57+
await cloneSizzle();
58+
const authors = await logAuthors( "cd .sizzle" );
59+
await cleanupSizzle();
60+
return authors;
61+
}
62+
63+
function sortAuthors( a, b ) {
64+
const [ , aDate ] = rdate.exec( a );
65+
const [ , bDate ] = rdate.exec( b );
66+
return Number( aDate ) - Number( bDate );
67+
}
68+
69+
function formatAuthor( author ) {
70+
return author.replace( rdate, "" );
71+
}
72+
73+
async function getAuthors() {
74+
console.log( "Getting authors..." );
75+
const authors = await logAuthors();
76+
const sizzleAuthors = await getSizzleAuthors();
77+
return uniq( authors.concat( sizzleAuthors ) ).sort( sortAuthors ).map( formatAuthor );
78+
}
79+
80+
async function checkAuthors() {
81+
const authors = await getAuthors();
82+
const lastAuthor = await getLastAuthor();
83+
84+
if ( authors[ authors.length - 1 ] !== lastAuthor ) {
85+
console.log( "AUTHORS.txt: ", lastAuthor );
86+
console.log( "Last 20 in git: ", authors.slice( -20 ) );
87+
throw new Error( "Last author in AUTHORS.txt does not match last git author" );
88+
}
89+
console.log( "AUTHORS.txt is up to date" );
90+
}
91+
92+
async function updateAuthors() {
93+
const authors = await getAuthors();
94+
95+
const authorsTxt = "Authors ordered by first contribution.\n\n" + authors.join( "\n" ) + "\n";
96+
await fs.promises.writeFile( "AUTHORS.txt", authorsTxt );
97+
98+
console.log( "AUTHORS.txt updated" );
99+
}
100+
101+
module.exports = {
102+
checkAuthors,
103+
getAuthors,
104+
updateAuthors
105+
};

package-lock.json

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
},
4040
"main": "dist/jquery.js",
4141
"scripts": {
42+
"authors:check": "node -e \"require('./build/release/authors.js').checkAuthors()\"",
43+
"authors:update": "node -e \"require('./build/release/authors.js').updateAuthors()\"",
4244
"babel:tests": "babel test/data/core/jquery-iterability-transpiled-es6.js --out-file test/data/core/jquery-iterability-transpiled.js",
4345
"build": "node ./build/command.js",
4446
"build:all": "node -e \"require('./build/tasks/build.js').buildDefaultFiles()\"",
@@ -101,7 +103,6 @@
101103
"globals": "13.20.0",
102104
"grunt": "1.5.3",
103105
"grunt-cli": "1.4.3",
104-
"grunt-git-authors": "3.2.0",
105106
"grunt-karma": "4.0.2",
106107
"husky": "8.0.3",
107108
"jsdom": "19.0.0",

0 commit comments

Comments
 (0)