aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/generate-code-contributors.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-09 12:00:47 +0100
committerChocobozzz <me@florianbigard.com>2020-01-09 12:00:47 +0100
commit41ee83423c234fdb5f6d09f21e3c5fe3ae6a192c (patch)
tree7d50b23136d3a6ddd25ec94cbe7845cefb2d4e7b /scripts/generate-code-contributors.ts
parente0b56b7495e809581a1e6447794bf7573a78af56 (diff)
downloadPeerTube-41ee83423c234fdb5f6d09f21e3c5fe3ae6a192c.tar.gz
PeerTube-41ee83423c234fdb5f6d09f21e3c5fe3ae6a192c.tar.zst
PeerTube-41ee83423c234fdb5f6d09f21e3c5fe3ae6a192c.zip
Rebuild credits
Had to update the script now we use weblate
Diffstat (limited to 'scripts/generate-code-contributors.ts')
-rwxr-xr-xscripts/generate-code-contributors.ts199
1 files changed, 140 insertions, 59 deletions
diff --git a/scripts/generate-code-contributors.ts b/scripts/generate-code-contributors.ts
index 5635d9889..5c6620f7d 100755
--- a/scripts/generate-code-contributors.ts
+++ b/scripts/generate-code-contributors.ts
@@ -5,6 +5,7 @@ registerTSPaths()
5import { doRequest } from '../server/helpers/requests' 5import { doRequest } from '../server/helpers/requests'
6import { readFileSync } from 'fs-extra' 6import { readFileSync } from 'fs-extra'
7import { uniqBy } from 'lodash' 7import { uniqBy } from 'lodash'
8import { execCLI } from '@shared/extra-utils'
8 9
9run() 10run()
10 .then(() => process.exit(0)) 11 .then(() => process.exit(0))
@@ -14,33 +15,20 @@ run()
14 }) 15 })
15 16
16async function run () { 17async function run () {
18 const blacklist = getContributorsBlacklist()
17 19
18 { 20 let contributors = await getGitContributors()
19 const contributors = await fetchGithub('https://api.github.com/repos/chocobozzz/peertube/contributors') 21 contributors = contributors.concat(getZanataContributors())
22 contributors = contributors.filter(c => blacklist[c.username] !== true)
20 23
21 console.log('# Code contributors\n') 24 console.log('# Code & Translators contributors\n')
22 for (const contributor of contributors) { 25 for (const contributor of contributors) {
23 const contributorUrl = contributor.url.replace('api.github.com/users', 'github.com') 26 console.log(` * ${contributor.username}`)
24 console.log(` * [${contributor.login}](${contributorUrl})`)
25 }
26 }
27
28 {
29 const zanataConfig = readFileSync(require('os').homedir() + '/.config/zanata.ini').toString()
30 const zanataUsername = zanataConfig.match('.username=([^\n]+)')[1]
31 const zanataToken = zanataConfig.match('.key=([^\n]+)')[1]
32
33 const translators = await fetchZanata(zanataUsername, zanataToken)
34
35 console.log('\n\n# Translation contributors\n')
36 for (const translator of translators) {
37 console.log(` * [${translator.username}](https://trad.framasoft.org/zanata/profile/view/${translator.username})`)
38 }
39 } 27 }
40 28
41 { 29 {
42 console.log('\n\n# Design\n') 30 console.log('\n\n# Design\n')
43 console.log(' * [Olivier Massain](https://twitter.com/omassain)') 31 console.log(' * [Olivier Massain](https://dribbble.com/omassain)')
44 32
45 console.log('\n\n# Icons\n') 33 console.log('\n\n# Icons\n')
46 console.log(' * [Robbie Pearce](https://robbiepearce.com/softies/)') 34 console.log(' * [Robbie Pearce](https://robbiepearce.com/softies/)')
@@ -49,47 +37,140 @@ async function run () {
49 } 37 }
50} 38}
51 39
52function get (url: string, headers: any = {}) { 40async function getGitContributors () {
53 return doRequest<any>({ 41 const output = await execCLI(`git --no-pager shortlog -sn < /dev/tty | sed 's/^\\s\\+[0-9]\\+\\s\\+//g'`)
54 uri: url,
55 json: true,
56 headers: Object.assign(headers, {
57 'User-Agent': 'PeerTube-App'
58 })
59 }).then(res => res.body)
60}
61
62async function fetchGithub (url: string) {
63 let next = url
64 let allResult = []
65
66 let i = 1
67 42
68 // Hard limit 43 return output.split('\n')
69 while (i < 20) { 44 .filter(l => !!l)
70 const result = await get(next + '?page=' + i) 45 .map(l => ({ username: l }))
71 if (result.length === 0) break
72
73 allResult = allResult.concat(result)
74 i++
75 }
76
77 return allResult
78} 46}
79 47
80async function fetchZanata (zanataUsername: string, zanataPassword: string) { 48// Zanata is dead, don't loose the contributors name
81 const today = new Date().toISOString().split('T')[0] 49function getZanataContributors () {
82 const year2018 = `https://trad.framasoft.org/zanata/rest/project/peertube/version/develop/contributors/2018-01-01..2019-01-01` 50 return [ { 'username': 'abdhessuk', 'name': 'Abd Hessuk' }, { 'username': 'abidin24', 'name': 'abidin toumi' }, {
83 const year2019 = `https://trad.framasoft.org/zanata/rest/project/peertube/version/develop/contributors/2019-01-01..${today}` 51 'username': 'aditoo',
52 'name': 'Lorem Ipsum'
53 }, { 'username': 'alice', 'name': 'Alice' }, { 'username': 'anastasia', 'name': 'Anastasia' }, {
54 'username': 'autom',
55 'name': 'Filip Bengtsson'
56 }, { 'username': 'balaji', 'name': 'Balaji' }, { 'username': 'bristow', 'name': 'Cédric F.' }, {
57 'username': 'butterflyoffire',
58 'name': 'ButterflyOfFire'
59 }, { 'username': 'chocobozzz', 'name': 'Chocobozzz' }, { 'username': 'claichou', 'name': 'Claire Mohin' }, {
60 'username': 'degrange',
61 'name': 'Degrange Mathieu'
62 }, { 'username': 'dibek', 'name': 'Giuseppe Di Bella' }, { 'username': 'edu', 'name': 'eduardo' }, {
63 'username': 'ehsaan',
64 'name': 'ehsaan'
65 }, { 'username': 'esoforte', 'name': 'Ondřej Kotas' }, { 'username': 'fkohrt', 'name': 'Florian Kohrt' }, {
66 'username': 'giqtaqisi',
67 'name': 'Ian Townsend'
68 }, { 'username': 'goofy', 'name': 'goofy' }, { 'username': 'gorkaazk', 'name': 'Gorka Azkarate Zubiaur' }, {
69 'username': 'gwendald',
70 'name': 'GwendalD'
71 }, { 'username': 'h3zjp', 'name': 'h3zjp' }, { 'username': 'jfblanc', 'name': 'Joan Francés Blanc' }, {
72 'username': 'jhertel',
73 'name': 'Jean Hertel'
74 }, { 'username': 'jmf', 'name': 'Jan-Michael Franz' }, { 'username': 'jorropo', 'name': 'Jorropo' }, {
75 'username': 'kairozen',
76 'name': 'Geoffrey Baudelet'
77 }, { 'username': 'kedemferre', 'name': 'Kédem Ferré' }, { 'username': 'kousha', 'name': 'Kousha Zanjani' }, {
78 'username': 'krkk',
79 'name': 'Karol Kosek'
80 }, { 'username': 'landrok', 'name': 'Landrok' }, { 'username': 'leeroyepold48', 'name': 'Leeroy Epold' }, {
81 'username': 'm4sk1n',
82 'name': 'marcin mikołajczak'
83 }, { 'username': 'matograine', 'name': 'tom ngr' }, { 'username': 'medow', 'name': 'Mahir Ahmed' }, {
84 'username': 'mhu',
85 'name': 'Max Hübner'
86 }, { 'username': 'midgard', 'name': 'Midgard' }, { 'username': 'nbrucy', 'name': 'N. B.' }, {
87 'username': 'nitai',
88 'name': 'nitai bezerra'
89 }, { 'username': 'noncommutativegeo', 'name': 'Andrea Panontin' }, { 'username': 'nopsidy', 'name': 'McFlat' }, {
90 'username': 'nvivant',
91 'name': 'Nicolas Vivant'
92 }, { 'username': 'osoitz', 'name': 'Osoitz' }, { 'username': 'outloudvi', 'name': 'Outvi V' }, {
93 'username': 'quentin',
94 'name': 'Quentí'
95 }, { 'username': 'quentind', 'name': 'Quentin Dupont' }, { 'username': 'rafaelff', 'name': 'Rafael Fontenelle' }, {
96 'username': 'rigelk',
97 'name': 'Rigel Kent'
98 }, { 'username': 's8321414', 'name': 'Jeff Huang' }, { 'username': 'sato_ss', 'name': 'Satoshi Shirosaka' }, {
99 'username': 'sercom_kc',
100 'name': 'SerCom_KC'
101 }, { 'username': 'severo', 'name': 'Sylvain Lesage' }, { 'username': 'silkevicious', 'name': 'Sylke Vicious' }, {
102 'username': 'sosha',
103 'name': 'Sosha'
104 }, { 'username': 'spla', 'name': 'spla' }, { 'username': 'strubbl', 'name': 'Sven' }, {
105 'username': 'swedneck',
106 'name': 'Tim Stahel'
107 }, { 'username': 'tagomago', 'name': 'Tagomago' }, { 'username': 'talone', 'name': 'TitiAlone' }, {
108 'username': 'thibaultmartin',
109 'name': 'Thibault Martin'
110 }, { 'username': 'tirifto', 'name': 'Tirifto' }, { 'username': 'tuxayo', 'name': 'Victor Grousset/tuxayo' }, {
111 'username': 'unextro',
112 'name': 'Ondřej Pokorný'
113 }, { 'username': 'unzarida', 'name': 'unzarida' }, { 'username': 'vincent', 'name': 'Vincent Laporte' }, {
114 'username': 'wanhua',
115 'name': 'wanhua'
116 }, { 'username': 'xinayder', 'name': 'Alexandre' }, { 'username': 'xosem', 'name': 'Xosé M.' }, {
117 'username': 'zveryok',
118 'name': 'Nikitin Stanislav'
119 }, { 'username': '6543', 'name': '6543' }, { 'username': 'aasami', 'name': 'Miroslav Ďurian' }, {
120 'username': 'alidemirtas',
121 'name': 'Ali Demirtas'
122 }, { 'username': 'alpha', 'name': 'Alpha' }, { 'username': 'ariasuni', 'name': 'Mélanie Chauvel' }, {
123 'username': 'bfonton',
124 'name': 'Baptiste Fonton'
125 }, { 'username': 'c0dr', 'name': 'c0dr lnx' }, { 'username': 'canony', 'name': 'canony' }, {
126 'username': 'cat',
127 'name': 'Cat'
128 }, { 'username': 'clerie', 'name': 'Clemens Riese' }, { 'username': 'curupira', 'name': 'Curupira' }, {
129 'username': 'dhsets',
130 'name': 'djsets'
131 }, { 'username': 'digitalkiller', 'name': 'Digital Killer' }, { 'username': 'dwsage', 'name': 'd.w. sage' }, {
132 'username': 'flauta',
133 'name': 'Andrea Primiani'
134 }, { 'username': 'frankstrater', 'name': 'Frank Sträter' }, { 'username': 'gillux', 'name': 'gillux' }, {
135 'username': 'gunchleoc',
136 'name': 'GunChleoc'
137 }, { 'username': 'jaidedtd', 'name': 'Jenga Phoenix' }, { 'username': 'joss2lyon', 'name': 'Josselin' }, {
138 'username': 'kekkotranslates',
139 'name': 'Francesco'
140 }, { 'username': 'kingu', 'name': 'Allan Nordhøy' }, { 'username': 'kittybecca', 'name': 'Rivka bat Tsvi' }, {
141 'username': 'knuxify',
142 'name': 'knuxify'
143 }, { 'username': 'lapor', 'name': 'Kristijan Tkalec' }, { 'username': 'laufor', 'name': 'Lau For' }, {
144 'username': 'lstamellos',
145 'name': 'Loukas Stamellos'
146 }, { 'username': 'lw1', 'name': 'Lukas Winkler' }, { 'username': 'mablr', 'name': 'Mablr' }, {
147 'username': 'marcinmalecki',
148 'name': 'Marcin Małecki'
149 }, { 'username': 'mayana', 'name': 'Mayana' }, { 'username': 'mikeorlov', 'name': 'Michael Orlov' }, {
150 'username': 'nin',
151 'name': 'nz'
152 }, { 'username': 'norbipeti', 'name': 'NorbiPeti' }, { 'username': 'ppnplus', 'name': 'Phongpanot Phairat' }, {
153 'username': 'predatorix',
154 'name': 'Predatorix'
155 }, { 'username': 'robin', 'name': 'Robin Lahtinen' }, { 'username': 'rond', 'name': 'rondnelly nunes' }, {
156 'username': 'secreet',
157 'name': 'Secreet'
158 }, { 'username': 'sftblw', 'name': 'sftblw' }, { 'username': 'sporiff', 'name': 'Ciarán Ainsworth' }, {
159 'username': 'tekuteku',
160 'name': 'tekuteku'
161 }, { 'username': 'thecatjustmeow', 'name': 'Nguyen Huynh Hung' }, { 'username': 'tmota', 'name': 'Tiago Mota' }, {
162 'username': 'uranix',
163 'name': 'Michal Mauser'
164 }, { 'username': 'wakutiteo', 'name': 'Markel' }, {
165 'username': 'wonderingdane',
166 'name': 'Nicolai Ireneo-Larsen'
167 }, { 'username': 'zeynepeliacik', 'name': 'Zeynep Can' } ]
168}
84 169
85 const headers = { 170function getContributorsBlacklist () {
86 'X-Auth-User': zanataUsername, 171 return {
87 'X-Auth-Token': zanataPassword 172 'Florian Bigard': true,
173 'chocobozzz': true,
174 'Rigel': true
88 } 175 }
89 const [ results2018, results2019 ] = await Promise.all([
90 get(year2018, headers),
91 get(year2019, headers)
92 ])
93
94 return uniqBy(results2018.concat(results2019) as { username: string }[], 'username')
95} 176}