refactor: move from "request" to "node fetch" (#277)

* feat: migrate from request to node-fetch

* docs(readme): add favna for all contributors

* fix: forgot to refactor this one

* style(gitlab): fixed formatting issues

Co-authored-by: Berkmann18 <maxieberkmann@gmail.com>
This commit is contained in:
Jeroen Claassens 2020-08-14 11:21:34 +02:00 committed by GitHub
parent 8af13c3f5e
commit 74f3b710a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 124 additions and 127 deletions

View file

@ -474,6 +474,15 @@
"contributions": [ "contributions": [
"code" "code"
] ]
},
{
"login": "Favna",
"name": "Jeroen Claassens",
"avatar_url": "https://avatars3.githubusercontent.com/u/4019718?v=4",
"profile": "https://favware.tech/",
"contributions": [
"code"
]
} }
], ],
"skipCi": true "skipCi": true

100
README.md
View file

@ -80,73 +80,77 @@ Thanks goes to these wonderful people
<!-- markdownlint-disable --> <!-- markdownlint-disable -->
<table> <table>
<tr> <tr>
<td align="center"><a href="https://github.com/jfmengels"><img src="https://avatars.githubusercontent.com/u/3869412?v=3" width="100px;" alt=""/><br /><sub><b>Jeroen Engels</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jfmengels" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jfmengels" title="Documentation">📖</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jfmengels" title="Tests">⚠️</a></td> <td align="center"><a href="https://github.com/jfmengels"><img src="https://avatars.githubusercontent.com/u/3869412?v=3?s=100" width="100px;" alt=""/><br /><sub><b>Jeroen Engels</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jfmengels" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jfmengels" title="Documentation">📖</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jfmengels" title="Tests">⚠️</a></td>
<td align="center"><a href="http://kentcdodds.com/"><img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;" alt=""/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=kentcdodds" title="Documentation">📖</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=kentcdodds" title="Code">💻</a></td> <td align="center"><a href="http://kentcdodds.com/"><img src="https://avatars.githubusercontent.com/u/1500684?v=3?s=100" width="100px;" alt=""/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=kentcdodds" title="Documentation">📖</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=kentcdodds" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/jccguimaraes"><img src="https://avatars.githubusercontent.com/u/14871650?v=3" width="100px;" alt=""/><br /><sub><b>João Guimarães</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jccguimaraes" title="Code">💻</a></td> <td align="center"><a href="https://github.com/jccguimaraes"><img src="https://avatars.githubusercontent.com/u/14871650?v=3?s=100" width="100px;" alt=""/><br /><sub><b>João Guimarães</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jccguimaraes" title="Code">💻</a></td>
<td align="center"><a href="http://beneb.info"><img src="https://avatars.githubusercontent.com/u/1282980?v=3" width="100px;" alt=""/><br /><sub><b>Ben Briggs</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=ben-eb" title="Code">💻</a></td> <td align="center"><a href="http://beneb.info"><img src="https://avatars.githubusercontent.com/u/1282980?v=3?s=100" width="100px;" alt=""/><br /><sub><b>Ben Briggs</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=ben-eb" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/itaisteinherz"><img src="https://avatars.githubusercontent.com/u/22768990?v=3" width="100px;" alt=""/><br /><sub><b>Itai Steinherz</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=itaisteinherz" title="Documentation">📖</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=itaisteinherz" title="Code">💻</a></td> <td align="center"><a href="https://github.com/itaisteinherz"><img src="https://avatars.githubusercontent.com/u/22768990?v=3?s=100" width="100px;" alt=""/><br /><sub><b>Itai Steinherz</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=itaisteinherz" title="Documentation">📖</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=itaisteinherz" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/alexjoverm"><img src="https://avatars.githubusercontent.com/u/5701162?v=3" width="100px;" alt=""/><br /><sub><b>Alex Jover</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=alexjoverm" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=alexjoverm" title="Documentation">📖</a></td> <td align="center"><a href="https://github.com/alexjoverm"><img src="https://avatars.githubusercontent.com/u/5701162?v=3?s=100" width="100px;" alt=""/><br /><sub><b>Alex Jover</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=alexjoverm" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=alexjoverm" title="Documentation">📖</a></td>
</tr> </tr>
<tr> <tr>
<td align="center"><a href="https://jerodsanto.net"><img src="https://avatars3.githubusercontent.com/u/8212?v=3" width="100px;" alt=""/><br /><sub><b>Jerod Santo</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jerodsanto" title="Code">💻</a></td> <td align="center"><a href="https://jerodsanto.net"><img src="https://avatars3.githubusercontent.com/u/8212?v=3?s=100" width="100px;" alt=""/><br /><sub><b>Jerod Santo</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jerodsanto" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/kevinjalbert"><img src="https://avatars1.githubusercontent.com/u/574871?v=3" width="100px;" alt=""/><br /><sub><b>Kevin Jalbert</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=kevinjalbert" title="Code">💻</a></td> <td align="center"><a href="https://github.com/kevinjalbert"><img src="https://avatars1.githubusercontent.com/u/574871?v=3?s=100" width="100px;" alt=""/><br /><sub><b>Kevin Jalbert</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=kevinjalbert" title="Code">💻</a></td>
<td align="center"><a href="https://i.am.charlike.online"><img src="https://avatars3.githubusercontent.com/u/5038030?v=4" width="100px;" alt=""/><br /><sub><b>tunnckoCore</b></sub></a><br /><a href="#tool-charlike" title="Tools">🔧</a></td> <td align="center"><a href="https://i.am.charlike.online"><img src="https://avatars3.githubusercontent.com/u/5038030?v=4?s=100" width="100px;" alt=""/><br /><sub><b>tunnckoCore</b></sub></a><br /><a href="#tool-charlike" title="Tools">🔧</a></td>
<td align="center"><a href="https://machour.idk.tn/"><img src="https://avatars2.githubusercontent.com/u/304450?v=4" width="100px;" alt=""/><br /><sub><b>Mehdi Achour</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=machour" title="Code">💻</a></td> <td align="center"><a href="https://machour.idk.tn/"><img src="https://avatars2.githubusercontent.com/u/304450?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mehdi Achour</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=machour" title="Code">💻</a></td>
<td align="center"><a href="https://codsen.com"><img src="https://avatars1.githubusercontent.com/u/8344688?v=4" width="100px;" alt=""/><br /><sub><b>Roy Revelt</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/issues?q=author%3Arevelt" title="Bug reports">🐛</a></td> <td align="center"><a href="https://codsen.com"><img src="https://avatars1.githubusercontent.com/u/8344688?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Roy Revelt</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/issues?q=author%3Arevelt" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/chrisinajar"><img src="https://avatars1.githubusercontent.com/u/422331?v=4" width="100px;" alt=""/><br /><sub><b>Chris Vickery</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=chrisinajar" title="Code">💻</a></td> <td align="center"><a href="https://github.com/chrisinajar"><img src="https://avatars1.githubusercontent.com/u/422331?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chris Vickery</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=chrisinajar" title="Code">💻</a></td>
</tr> </tr>
<tr> <tr>
<td align="center"><a href="https://github.com/brycereynolds"><img src="https://avatars2.githubusercontent.com/u/1026002?v=4" width="100px;" alt=""/><br /><sub><b>Bryce Reynolds</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=brycereynolds" title="Code">💻</a></td> <td align="center"><a href="https://github.com/brycereynolds"><img src="https://avatars2.githubusercontent.com/u/1026002?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Bryce Reynolds</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=brycereynolds" title="Code">💻</a></td>
<td align="center"><a href="http://www.jmeas.com"><img src="https://avatars3.githubusercontent.com/u/2322305?v=4" width="100px;" alt=""/><br /><sub><b>James, please</b></sub></a><br /><a href="#ideas-jmeas" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jmeas" title="Code">💻</a></td> <td align="center"><a href="http://www.jmeas.com"><img src="https://avatars3.githubusercontent.com/u/2322305?v=4?s=100" width="100px;" alt=""/><br /><sub><b>James, please</b></sub></a><br /><a href="#ideas-jmeas" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jmeas" title="Code">💻</a></td>
<td align="center"><a href="http://www.spyros.io"><img src="https://avatars3.githubusercontent.com/u/1057324?v=4" width="100px;" alt=""/><br /><sub><b>Spyros Ioakeimidis</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=spirosikmd" title="Code">💻</a></td> <td align="center"><a href="http://www.spyros.io"><img src="https://avatars3.githubusercontent.com/u/1057324?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Spyros Ioakeimidis</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=spirosikmd" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/fadc80"><img src="https://avatars3.githubusercontent.com/u/12335761?v=4" width="100px;" alt=""/><br /><sub><b>Fernando Costa</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=fadc80" title="Code">💻</a></td> <td align="center"><a href="https://github.com/fadc80"><img src="https://avatars3.githubusercontent.com/u/12335761?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Fernando Costa</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=fadc80" title="Code">💻</a></td>
<td align="center"><a href="https://snipe.net"><img src="https://avatars0.githubusercontent.com/u/197404?v=4" width="100px;" alt=""/><br /><sub><b>snipe</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=snipe" title="Documentation">📖</a></td> <td align="center"><a href="https://snipe.net"><img src="https://avatars0.githubusercontent.com/u/197404?v=4?s=100" width="100px;" alt=""/><br /><sub><b>snipe</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=snipe" title="Documentation">📖</a></td>
<td align="center"><a href="http://gantlaborde.com/"><img src="https://avatars0.githubusercontent.com/u/997157?v=4" width="100px;" alt=""/><br /><sub><b>Gant Laborde</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=GantMan" title="Code">💻</a></td> <td align="center"><a href="http://gantlaborde.com/"><img src="https://avatars0.githubusercontent.com/u/997157?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gant Laborde</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=GantMan" title="Code">💻</a></td>
</tr> </tr>
<tr> <tr>
<td align="center"><a href="https://in.linkedin.com/in/mzubairahmed"><img src="https://avatars2.githubusercontent.com/u/17708702?v=4" width="100px;" alt=""/><br /><sub><b>Md Zubair Ahmed</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=M-ZubairAhmed" title="Documentation">📖</a> <a href="https://github.com/all-contributors/all-contributors-cli/issues?q=author%3AM-ZubairAhmed" title="Bug reports">🐛</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=M-ZubairAhmed" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=M-ZubairAhmed" title="Tests">⚠️</a></td> <td align="center"><a href="https://in.linkedin.com/in/mzubairahmed"><img src="https://avatars2.githubusercontent.com/u/17708702?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Md Zubair Ahmed</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=M-ZubairAhmed" title="Documentation">📖</a> <a href="https://github.com/all-contributors/all-contributors-cli/issues?q=author%3AM-ZubairAhmed" title="Bug reports">🐛</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=M-ZubairAhmed" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=M-ZubairAhmed" title="Tests">⚠️</a></td>
<td align="center"><a href="http://bogas04.github.io"><img src="https://avatars3.githubusercontent.com/u/6177621?v=4" width="100px;" alt=""/><br /><sub><b>Divjot Singh</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=bogas04" title="Documentation">📖</a></td> <td align="center"><a href="http://bogas04.github.io"><img src="https://avatars3.githubusercontent.com/u/6177621?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Divjot Singh</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=bogas04" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/tigermarques"><img src="https://avatars0.githubusercontent.com/u/15315098?v=4" width="100px;" alt=""/><br /><sub><b>João Marques</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=tigermarques" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=tigermarques" title="Documentation">📖</a> <a href="#ideas-tigermarques" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/tigermarques"><img src="https://avatars0.githubusercontent.com/u/15315098?v=4?s=100" width="100px;" alt=""/><br /><sub><b>João Marques</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=tigermarques" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=tigermarques" title="Documentation">📖</a> <a href="#ideas-tigermarques" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="http://hipstersmoothie.com"><img src="https://avatars3.githubusercontent.com/u/1192452?v=4" width="100px;" alt=""/><br /><sub><b>Andrew Lisowski</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=hipstersmoothie" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=hipstersmoothie" title="Documentation">📖</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=hipstersmoothie" title="Tests">⚠️</a></td> <td align="center"><a href="http://hipstersmoothie.com"><img src="https://avatars3.githubusercontent.com/u/1192452?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Andrew Lisowski</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=hipstersmoothie" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=hipstersmoothie" title="Documentation">📖</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=hipstersmoothie" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/chinesedfan"><img src="https://avatars3.githubusercontent.com/u/1736154?v=4" width="100px;" alt=""/><br /><sub><b>Xianming Zhong</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=chinesedfan" title="Documentation">📖</a></td> <td align="center"><a href="https://github.com/chinesedfan"><img src="https://avatars3.githubusercontent.com/u/1736154?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Xianming Zhong</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=chinesedfan" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/xuchaoying"><img src="https://avatars2.githubusercontent.com/u/8073251?v=4" width="100px;" alt=""/><br /><sub><b>C.Y.Xu</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=xuchaoying" title="Code">💻</a></td> <td align="center"><a href="https://github.com/xuchaoying"><img src="https://avatars2.githubusercontent.com/u/8073251?v=4?s=100" width="100px;" alt=""/><br /><sub><b>C.Y.Xu</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=xuchaoying" title="Code">💻</a></td>
</tr> </tr>
<tr> <tr>
<td align="center"><a href="https://github.com/chris-dura"><img src="https://avatars3.githubusercontent.com/u/3680914?v=4" width="100px;" alt=""/><br /><sub><b>Dura</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=chris-dura" title="Documentation">📖</a></td> <td align="center"><a href="https://github.com/chris-dura"><img src="https://avatars3.githubusercontent.com/u/3680914?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dura</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=chris-dura" title="Documentation">📖</a></td>
<td align="center"><a href="https://jakebolam.com"><img src="https://avatars2.githubusercontent.com/u/3534236?v=4" width="100px;" alt=""/><br /><sub><b>Jake Bolam</b></sub></a><br /><a href="#infra-jakebolam" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jakebolam" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jakebolam" title="Documentation">📖</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jakebolam" title="Tests">⚠️</a> <a href="https://github.com/all-contributors/all-contributors-cli/pulls?q=is%3Apr+reviewed-by%3Ajakebolam" title="Reviewed Pull Requests">👀</a> <a href="#question-jakebolam" title="Answering Questions">💬</a></td> <td align="center"><a href="https://jakebolam.com"><img src="https://avatars2.githubusercontent.com/u/3534236?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jake Bolam</b></sub></a><br /><a href="#infra-jakebolam" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jakebolam" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jakebolam" title="Documentation">📖</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jakebolam" title="Tests">⚠️</a> <a href="https://github.com/all-contributors/all-contributors-cli/pulls?q=is%3Apr+reviewed-by%3Ajakebolam" title="Reviewed Pull Requests">👀</a> <a href="#question-jakebolam" title="Answering Questions">💬</a></td>
<td align="center"><a href="http://maxcubing.wordpress.com"><img src="https://avatars0.githubusercontent.com/u/8260834?v=4" width="100px;" alt=""/><br /><sub><b>Maximilian Berkmann</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=Berkmann18" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=Berkmann18" title="Tests">⚠️</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=Berkmann18" title="Documentation">📖</a> <a href="#tool-Berkmann18" title="Tools">🔧</a> <a href="#maintenance-Berkmann18" title="Maintenance">🚧</a> <a href="https://github.com/all-contributors/all-contributors-cli/pulls?q=is%3Apr+reviewed-by%3ABerkmann18" title="Reviewed Pull Requests">👀</a> <a href="#question-Berkmann18" title="Answering Questions">💬</a></td> <td align="center"><a href="http://maxcubing.wordpress.com"><img src="https://avatars0.githubusercontent.com/u/8260834?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Maximilian Berkmann</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=Berkmann18" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=Berkmann18" title="Tests">⚠️</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=Berkmann18" title="Documentation">📖</a> <a href="#tool-Berkmann18" title="Tools">🔧</a> <a href="#maintenance-Berkmann18" title="Maintenance">🚧</a> <a href="https://github.com/all-contributors/all-contributors-cli/pulls?q=is%3Apr+reviewed-by%3ABerkmann18" title="Reviewed Pull Requests">👀</a> <a href="#question-Berkmann18" title="Answering Questions">💬</a></td>
<td align="center"><a href="https://github.com/tbenning"><img src="https://avatars2.githubusercontent.com/u/7265547?v=4" width="100px;" alt=""/><br /><sub><b>tbenning</b></sub></a><br /><a href="#design-tbenning" title="Design">🎨</a></td> <td align="center"><a href="https://github.com/tbenning"><img src="https://avatars2.githubusercontent.com/u/7265547?v=4?s=100" width="100px;" alt=""/><br /><sub><b>tbenning</b></sub></a><br /><a href="#design-tbenning" title="Design">🎨</a></td>
<td align="center"><a href="https://twitter.com/ehmicky"><img src="https://avatars2.githubusercontent.com/u/8136211?v=4" width="100px;" alt=""/><br /><sub><b>ehmicky</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=ehmicky" title="Code">💻</a></td> <td align="center"><a href="https://twitter.com/ehmicky"><img src="https://avatars2.githubusercontent.com/u/8136211?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ehmicky</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=ehmicky" title="Code">💻</a></td>
<td align="center"><a href="https://ghuser.io/jamesgeorge007"><img src="https://avatars2.githubusercontent.com/u/25279263?v=4" width="100px;" alt=""/><br /><sub><b>James George</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jamesgeorge007" title="Code">💻</a></td> <td align="center"><a href="https://ghuser.io/jamesgeorge007"><img src="https://avatars2.githubusercontent.com/u/25279263?v=4?s=100" width="100px;" alt=""/><br /><sub><b>James George</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=jamesgeorge007" title="Code">💻</a></td>
</tr> </tr>
<tr> <tr>
<td align="center"><a href="https://github.com/nschonni"><img src="https://avatars2.githubusercontent.com/u/1297909?v=4" width="100px;" alt=""/><br /><sub><b>Nick Schonning</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=nschonni" title="Code">💻</a></td> <td align="center"><a href="https://github.com/nschonni"><img src="https://avatars2.githubusercontent.com/u/1297909?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nick Schonning</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=nschonni" title="Code">💻</a></td>
<td align="center"><a href="https://cezaraugusto.net/"><img src="https://avatars0.githubusercontent.com/u/4672033?v=4" width="100px;" alt=""/><br /><sub><b>Cezar Augusto</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=cezaraugusto" title="Documentation">📖</a></td> <td align="center"><a href="https://cezaraugusto.net/"><img src="https://avatars0.githubusercontent.com/u/4672033?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Cezar Augusto</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=cezaraugusto" title="Documentation">📖</a></td>
<td align="center"><a href="https://reinhold.is"><img src="https://avatars1.githubusercontent.com/u/5678122?v=4" width="100px;" alt=""/><br /><sub><b>Jeppe Reinhold</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=JReinhold" title="Code">💻</a></td> <td align="center"><a href="https://reinhold.is"><img src="https://avatars1.githubusercontent.com/u/5678122?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeppe Reinhold</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=JReinhold" title="Code">💻</a></td>
<td align="center"><a href="https://rachelcarmena.github.io"><img src="https://avatars0.githubusercontent.com/u/22792183?v=4" width="100px;" alt=""/><br /><sub><b>Rachel M. Carmena</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=rachelcarmena" title="Code">💻</a></td> <td align="center"><a href="https://rachelcarmena.github.io"><img src="https://avatars0.githubusercontent.com/u/22792183?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Rachel M. Carmena</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=rachelcarmena" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/simon300000"><img src="https://avatars1.githubusercontent.com/u/12656264?v=4" width="100px;" alt=""/><br /><sub><b>simon3000</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=simon300000" title="Tests">⚠️</a></td> <td align="center"><a href="https://github.com/simon300000"><img src="https://avatars1.githubusercontent.com/u/12656264?v=4?s=100" width="100px;" alt=""/><br /><sub><b>simon3000</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=simon300000" title="Tests">⚠️</a></td>
<td align="center"><a href="https://sno2wman.dev/"><img src="https://avatars3.githubusercontent.com/u/15155608?v=4" width="100px;" alt=""/><br /><sub><b>SnO₂WMaN</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=SnO2WMaN" title="Code">💻</a></td> <td align="center"><a href="https://sno2wman.dev/"><img src="https://avatars3.githubusercontent.com/u/15155608?v=4?s=100" width="100px;" alt=""/><br /><sub><b>SnO₂WMaN</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=SnO2WMaN" title="Code">💻</a></td>
</tr> </tr>
<tr> <tr>
<td align="center"><a href="https://www.destro.me"><img src="https://avatars1.githubusercontent.com/u/7031675?v=4" width="100px;" alt=""/><br /><sub><b>Fabrizio</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/issues?q=author%3Adexpota" title="Bug reports">🐛</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=dexpota" title="Code">💻</a></td> <td align="center"><a href="https://www.destro.me"><img src="https://avatars1.githubusercontent.com/u/7031675?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Fabrizio</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/issues?q=author%3Adexpota" title="Bug reports">🐛</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=dexpota" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/kharaone"><img src="https://avatars1.githubusercontent.com/u/6599271?v=4" width="100px;" alt=""/><br /><sub><b>kharaone</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=kharaone" title="Code">💻</a></td> <td align="center"><a href="https://github.com/kharaone"><img src="https://avatars1.githubusercontent.com/u/6599271?v=4?s=100" width="100px;" alt=""/><br /><sub><b>kharaone</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=kharaone" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/marceloalves"><img src="https://avatars1.githubusercontent.com/u/216782?v=4" width="100px;" alt=""/><br /><sub><b>Marcelo Alves</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=MarceloAlves" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=MarceloAlves" title="Tests">⚠️</a></td> <td align="center"><a href="https://github.com/marceloalves"><img src="https://avatars1.githubusercontent.com/u/216782?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Marcelo Alves</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=MarceloAlves" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=MarceloAlves" title="Tests">⚠️</a></td>
<td align="center"><a href="https://anandchowdhary.com/?utm_source=github&utm_campaign=about-link"><img src="https://avatars3.githubusercontent.com/u/2841780?v=4" width="100px;" alt=""/><br /><sub><b>Anand Chowdhary</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=AnandChowdhary" title="Tests">⚠️</a> <a href="https://github.com/all-contributors/all-contributors-cli/issues?q=author%3AAnandChowdhary" title="Bug reports">🐛</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=AnandChowdhary" title="Code">💻</a></td> <td align="center"><a href="https://anandchowdhary.com/?utm_source=github&utm_campaign=about-link"><img src="https://avatars3.githubusercontent.com/u/2841780?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Anand Chowdhary</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=AnandChowdhary" title="Tests">⚠️</a> <a href="https://github.com/all-contributors/all-contributors-cli/issues?q=author%3AAnandChowdhary" title="Bug reports">🐛</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=AnandChowdhary" title="Code">💻</a></td>
<td align="center"><a href="https://phacks.dev/"><img src="https://avatars1.githubusercontent.com/u/2587348?v=4" width="100px;" alt=""/><br /><sub><b>Nicolas Goutay</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=phacks" title="Code">💻</a></td> <td align="center"><a href="https://phacks.dev/"><img src="https://avatars1.githubusercontent.com/u/2587348?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nicolas Goutay</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=phacks" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/tylerkrupicka"><img src="https://avatars1.githubusercontent.com/u/5761061?s=460&v=4" width="100px;" alt=""/><br /><sub><b>Tyler Krupicka</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=tylerkrupicka" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=tylerkrupicka" title="Tests">⚠️</a></td> <td align="center"><a href="https://github.com/tylerkrupicka"><img src="https://avatars1.githubusercontent.com/u/5761061?s=460&v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tyler Krupicka</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=tylerkrupicka" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=tylerkrupicka" title="Tests">⚠️</a></td>
</tr> </tr>
<tr> <tr>
<td align="center"><a href="https://github.com/smoia"><img src="https://avatars3.githubusercontent.com/u/35300580?v=4" width="100px;" alt=""/><br /><sub><b>Stefano Moia</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=smoia" title="Code">💻</a></td> <td align="center"><a href="https://github.com/smoia"><img src="https://avatars3.githubusercontent.com/u/35300580?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Stefano Moia</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=smoia" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/ilai-deutel"><img src="https://avatars0.githubusercontent.com/u/10098207?v=4" width="100px;" alt=""/><br /><sub><b>Ilaï Deutel</b></sub></a><br /><a href="#platform-ilai-deutel" title="Packaging/porting to new platform">📦</a></td> <td align="center"><a href="https://github.com/ilai-deutel"><img src="https://avatars0.githubusercontent.com/u/10098207?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ilaï Deutel</b></sub></a><br /><a href="#platform-ilai-deutel" title="Packaging/porting to new platform">📦</a></td>
<td align="center"><a href="https://github.com/k3nsei"><img src="https://avatars2.githubusercontent.com/u/190422?v=4" width="100px;" alt=""/><br /><sub><b>Piotr Stępniewski</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/issues?q=author%3Ak3nsei" title="Bug reports">🐛</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=k3nsei" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=k3nsei" title="Tests">⚠️</a></td> <td align="center"><a href="https://github.com/k3nsei"><img src="https://avatars2.githubusercontent.com/u/190422?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Piotr Stępniewski</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/issues?q=author%3Ak3nsei" title="Bug reports">🐛</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=k3nsei" title="Code">💻</a> <a href="https://github.com/all-contributors/all-contributors-cli/commits?author=k3nsei" title="Tests">⚠️</a></td>
<td align="center"><a href="https://dev.to/gr2m"><img src="https://avatars3.githubusercontent.com/u/39992?v=4" width="100px;" alt=""/><br /><sub><b>Gregor Martynus</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/pulls?q=is%3Apr+reviewed-by%3Agr2m" title="Reviewed Pull Requests">👀</a> <a href="#question-gr2m" title="Answering Questions">💬</a></td> <td align="center"><a href="https://dev.to/gr2m"><img src="https://avatars3.githubusercontent.com/u/39992?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gregor Martynus</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/pulls?q=is%3Apr+reviewed-by%3Agr2m" title="Reviewed Pull Requests">👀</a> <a href="#question-gr2m" title="Answering Questions">💬</a></td>
<td align="center"><a href="https://sinchang.me/"><img src="https://avatars0.githubusercontent.com/u/3297859?v=4" width="100px;" alt=""/><br /><sub><b>Jeff Wen</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/pulls?q=is%3Apr+reviewed-by%3Asinchang" title="Reviewed Pull Requests">👀</a></td> <td align="center"><a href="https://sinchang.me/"><img src="https://avatars0.githubusercontent.com/u/3297859?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeff Wen</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/pulls?q=is%3Apr+reviewed-by%3Asinchang" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://github.com/pavelloz"><img src="https://avatars1.githubusercontent.com/u/546845?v=4" width="100px;" alt=""/><br /><sub><b>Paweł Kowalski</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=pavelloz" title="Code">💻</a></td> <td align="center"><a href="https://github.com/pavelloz"><img src="https://avatars1.githubusercontent.com/u/546845?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Paweł Kowalski</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=pavelloz" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://favware.tech/"><img src="https://avatars3.githubusercontent.com/u/4019718?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeroen Claassens</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=Favna" title="Code">💻</a></td>
</tr> </tr>
</table> </table>
<!-- markdownlint-restore --> <!-- markdownlint-restore -->
<!-- prettier-ignore-end --> <!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END --> <!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the This project follows the

View file

@ -49,8 +49,8 @@
"inquirer": "^7.0.4", "inquirer": "^7.0.4",
"json-fixer": "^1.5.1", "json-fixer": "^1.5.1",
"lodash": "^4.11.2", "lodash": "^4.11.2",
"node-fetch": "^2.6.0",
"pify": "^5.0.0", "pify": "^5.0.0",
"request": "^2.72.0",
"yargs": "^15.0.1" "yargs": "^15.0.1"
}, },
"devDependencies": { "devDependencies": {

View file

@ -1,7 +1,6 @@
const url = require('url') const url = require('url')
const pify = require('pify') const fetch = require('node-fetch')
const request = pify(require('request')) const {parseHttpUrl, isValidHttpUrl} = require('../util/url')
const { parseHttpUrl, isValidHttpUrl } = require('../util/url')
/** /**
* Get the host based on public or enterprise GitHub. * Get the host based on public or enterprise GitHub.
@ -23,16 +22,16 @@ function getApiHost(hostname) {
return hostname.replace(/:\/\//, '://api.') return hostname.replace(/:\/\//, '://api.')
} }
function getRequestHeaders(optionalPrivateToken = '') { function getFetchHeaders(optionalPrivateToken = '') {
const requestHeaders = { const fetchHeaders = {
'User-Agent': 'request', 'User-Agent': 'node-fetch',
} }
if (optionalPrivateToken && optionalPrivateToken.length > 0) { if (optionalPrivateToken && optionalPrivateToken.length > 0) {
requestHeaders.Authorization = `token ${optionalPrivateToken}` fetchHeaders.Authorization = `token ${optionalPrivateToken}`
} }
return requestHeaders return fetchHeaders
} }
function getNextLink(link) { function getNextLink(link) {
@ -50,22 +49,20 @@ function getNextLink(link) {
} }
function getContributorsPage(githubUrl, optionalPrivateToken) { function getContributorsPage(githubUrl, optionalPrivateToken) {
return request return fetch(githubUrl, {
.get({ headers: getFetchHeaders(optionalPrivateToken),
url: githubUrl, }).then(res => {
headers: getRequestHeaders(optionalPrivateToken), if (res.status === 404 || res.status >= 500) {
}) throw new Error('No contributors found on the GitLab repository')
.then(res => { }
const body = JSON.parse(res.body)
if (res.statusCode >= 400) { return res.json().then(body => {
if (res.statusCode === 404) { if (res.status >= 400 || !res.ok) {
throw new Error('No contributors found on the GitHub repository')
}
throw new Error(body.message) throw new Error(body.message)
} }
const contributorsIds = body.map(contributor => contributor.login) const contributorsIds = body.map(contributor => contributor.login)
const nextLink = getNextLink(res.headers.link) const nextLink = getNextLink(res.headers.get('link'))
if (nextLink) { if (nextLink) {
return getContributorsPage(nextLink, optionalPrivateToken).then( return getContributorsPage(nextLink, optionalPrivateToken).then(
nextContributors => { nextContributors => {
@ -76,9 +73,10 @@ function getContributorsPage(githubUrl, optionalPrivateToken) {
return contributorsIds return contributorsIds
}) })
})
} }
const getUserInfo = function(username, hostname, optionalPrivateToken) { const getUserInfo = function (username, hostname, optionalPrivateToken) {
if (!username) { if (!username) {
throw new Error( throw new Error(
`No login when adding a contributor. Please specify a username.`, `No login when adding a contributor. Please specify a username.`,
@ -86,20 +84,16 @@ const getUserInfo = function(username, hostname, optionalPrivateToken) {
} }
const root = getApiHost(hostname) const root = getApiHost(hostname)
return request return fetch(`${root}/users/${username}`, {
.get({ headers: getFetchHeaders(optionalPrivateToken),
url: `${root}/users/${username}`, }).then(res =>
headers: getRequestHeaders(optionalPrivateToken), res.json().then(body => {
})
.then(res => {
const body = JSON.parse(res.body)
let profile = isValidHttpUrl(body.blog) ? body.blog : body.html_url let profile = isValidHttpUrl(body.blog) ? body.blog : body.html_url
// Check for authentication required // Check for authentication required
if ( if (
(!profile && body.message.includes('Must authenticate')) || (!profile && body.message.includes('Must authenticate')) ||
res.statusCode === 401 res.status === 401
) { ) {
throw new Error( throw new Error(
`Missing authentication for GitHub API. Did you set PRIVATE_TOKEN?`, `Missing authentication for GitHub API. Did you set PRIVATE_TOKEN?`,
@ -121,10 +115,11 @@ const getUserInfo = function(username, hostname, optionalPrivateToken) {
avatar_url: body.avatar_url, avatar_url: body.avatar_url,
profile, profile,
} }
}) }),
)
} }
const getContributors = function(owner, name, hostname, optionalPrivateToken) { const getContributors = function (owner, name, hostname, optionalPrivateToken) {
const root = getApiHost(hostname) const root = getApiHost(hostname)
const contributorsUrl = `${root}/repos/${owner}/${name}/contributors?per_page=100` const contributorsUrl = `${root}/repos/${owner}/${name}/contributors?per_page=100`
return getContributorsPage(contributorsUrl, optionalPrivateToken) return getContributorsPage(contributorsUrl, optionalPrivateToken)

View file

@ -1,5 +1,4 @@
const pify = require('pify') const fetch = require('node-fetch')
const request = pify(require('request'))
const addPrivateToken = (url, privateToken = '') => { const addPrivateToken = (url, privateToken = '') => {
if (privateToken === '') return url if (privateToken === '') return url
@ -9,25 +8,24 @@ const addPrivateToken = (url, privateToken = '') => {
.replace('&', '?') .replace('&', '?')
} }
const getUserInfo = function(username, hostname, privateToken) { const getUserInfo = function (username, hostname, privateToken) {
/* eslint-disable complexity */ /* eslint-disable complexity */
if (!hostname) { if (!hostname) {
hostname = 'https://gitlab.com' hostname = 'https://gitlab.com'
} }
return request return fetch(
.get({ addPrivateToken(
url: addPrivateToken( `${hostname}/api/v4/users?username=${username}`,
`${hostname}/api/v4/users?username=${username}`, privateToken,
privateToken, ),
), {
headers: { headers: {
'User-Agent': 'request', 'User-Agent': 'node-fetch',
}, },
}) },
.then(res => { ).then(res =>
const body = JSON.parse(res.body) res.json().then(body => {
// Gitlab returns an array of users. If it is empty, it means the username provided does not exist // Gitlab returns an array of users. If it is empty, it means the username provided does not exist
if (!body || body.length === 0) { if (!body || body.length === 0) {
throw new Error(`User ${username} not found`) throw new Error(`User ${username} not found`)
@ -48,27 +46,20 @@ const getUserInfo = function(username, hostname, privateToken) {
? user.web_url ? user.web_url
: `http://${user.web_url}`, : `http://${user.web_url}`,
} }
}) }),
)
} }
const getContributors = function(owner, name, hostname, privateToken) { const getContributors = function (owner, name, hostname, privateToken) {
if (!hostname) { if (!hostname) {
hostname = 'https://gitlab.com' hostname = 'https://gitlab.com'
} }
return request return fetch(
.get({ addPrivateToken(`${hostname}/api/v4/projects?search=${name}`, privateToken),
url: addPrivateToken( {headers: {'User-Agent': 'node-fetch'}},
`${hostname}/api/v4/projects?search=${name}`, ).then(res =>
privateToken, res.json().then(projects => {
),
headers: {
'User-Agent': 'request',
},
})
.then(res => {
const projects = JSON.parse(res.body)
// Gitlab returns an array of users. If it is empty, it means the username provided does not exist // Gitlab returns an array of users. If it is empty, it means the username provided does not exist
if (!projects || projects.length === 0) { if (!projects || projects.length === 0) {
throw new Error(`Project ${owner}/${name} not found`) throw new Error(`Project ${owner}/${name} not found`)
@ -86,27 +77,25 @@ const getContributors = function(owner, name, hostname, privateToken) {
throw new Error(`Project ${owner}/${name} not found`) throw new Error(`Project ${owner}/${name} not found`)
} }
return request return fetch(
.get({ addPrivateToken(
url: addPrivateToken( `${hostname}/api/v4/projects/${project.id}/repository/contributors`,
`${hostname}/api/v4/projects/${project.id}/repository/contributors`, privateToken,
privateToken, ),
), {headers: {'User-Agent': 'node-fetch'}},
headers: { ).then(newRes => {
'User-Agent': 'request', if (newRes.status === 404 || newRes.status >= 500) {
}, throw new Error('No contributors found on the GitLab repository')
}) }
.then(newRes => { return newRes.json().then(contributors => {
const contributors = JSON.parse(newRes.body) if (newRes.status >= 400 || !newRes.ok) {
if (newRes.statusCode >= 400) {
if (newRes.statusCode === 404) {
throw new Error('No contributors found on the GitLab repository')
}
throw new Error(contributors.message) throw new Error(contributors.message)
} }
return contributors.map(item => item.name) return contributors.map(item => item.name)
}) })
}) })
}),
)
} }
module.exports = { module.exports = {