1+ ( ( ) => {
2+ const authors = [
3+ { username : 'jcsnider' , link : 'https://github.com/jcsnider' , name : 'JC Snider' } ,
4+ { username : 'irokaiser' , link : 'https://github.com/irokaiser' , name : 'Joe Bridges' } ,
5+ { username : 'lodicolo' , link : 'https://github.com/lodicolo' , name : 'Robbie Lodico' } ,
6+ ] ;
7+
8+ const maintainers = [
9+ { username : 'cheshire92' , link : 'https://github.com/Cheshire92' , name : 'Jocelyn Cobb' } ,
10+ ] ;
11+
12+ const collaborators = [
13+ { username : 'alexvild' , link : 'https://github.com/AlexVild' , name : 'Alex Vild' } ,
14+ { username : 'arufonsu' , link : 'https://github.com/Arufonsu' , name : 'Fernando Arzola Lagos' } ,
15+ { username : 'weylonsantana' , link : 'https://github.com/WeylonSantana' , name : 'Weylon Santana' } ,
16+ ] ;
17+
18+ const usernamesToIgnore = new Set ( [
19+ 'AlexVild' ,
20+ 'alloin' , /* listed under a different name */
21+ 'Arufonsu' ,
22+ 'Cheshire92' ,
23+ 'apps/dependabot' , /* bot */
24+ 'Irokaiser' ,
25+ 'jcsnider' ,
26+ 'lodicolo' ,
27+ 'WeylonSantana'
28+ ] . map ( username => username . toLowerCase ( ) ) ) ;
29+
30+ const contributorsToAdd = [
31+ {
32+ link : '#' ,
33+ name : 'Dog from the Kash Shop' ,
34+ username : 'dog-from-the-kash-shop' , /* used for sorting */
35+ }
36+ ]
37+
38+ const mappedNames = new Map ( [
39+ [ 'airobinnet' , 'AIRobin (airobinnet, alloin)' ] ,
40+ [ 'redbandana' , 'Shenmue (RedBandana)' ]
41+ ] ) ;
42+
43+ function getUsername ( url ) {
44+ return url . replace ( 'https://github.com/' , '' ) . toLowerCase ( ) ;
45+ }
46+
47+ function userToLine ( { name, link } ) {
48+ return `[${ name } ](${ link } )` ;
49+ }
50+
51+ const contributorLinks = [ ...document . querySelector ( '[app-name=repos-contributors-chart]' ) ?. querySelectorAll ( 'h2 a.prc-Link-Link-85e08' ) ?? [ ] ] ;
52+ const allContributors = [
53+ ...contributorsToAdd ,
54+ ...contributorLinks . map ( ( { href, textContent } ) => {
55+ const username = getUsername ( href ) ;
56+ return {
57+ link : href ,
58+ name : mappedNames . get ( username ) ?? textContent ,
59+ username
60+ } ;
61+ } ) ,
62+ ] ;
63+
64+ const filteredContributors = allContributors . filter ( ( { username } ) => ! usernamesToIgnore . has ( username ) ) ;
65+ const sortedContributors = filteredContributors . toSorted ( ( { username : a } , { username : b } ) => a ?. localeCompare ( b ) ) ;
66+
67+ return {
68+ 'AUTHORS.md' : `# Authors
69+
70+ ${ authors . map ( userToLine ) . join ( '\n\n' ) }
71+
72+ # Maintainers
73+
74+ ${ maintainers . map ( userToLine ) . join ( '\n\n' ) }
75+
76+ # Collaborators
77+
78+ ${ collaborators . map ( userToLine ) . join ( '\n\n' ) }
79+
80+ # Contributors
81+
82+ ${ sortedContributors . map ( userToLine ) . join ( '\n\n' ) } `,
83+ creditsObjects : sortedContributors . map ( ( { name } ) => ( {
84+ "Text" : name ,
85+ "Font" : "sourcesansproblack" ,
86+ "Size" : 12 ,
87+ "Alignment" : "center"
88+ } ) ) ,
89+ } ;
90+ } ) ( )
0 commit comments