MCPcopy
hub / github.com/ajv-validator/ajv / main

Function main

scripts/get-contributors.js:16–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14main()
15
16async function main() {
17 const fetch = (await import("node-fetch")).default
18
19 const contributors = []
20 let page = 1
21
22 // eslint-disable-next-line no-constant-condition
23 while (true) {
24 const res = await fetch(`${base}?per_page=100&page=${page++}`, {
25 headers: {Authorization: `token ${GH_TOKEN_PUBLIC}`},
26 })
27 const list = await res.json()
28 if (list.length === 0) break
29 contributors.push(...list)
30 }
31
32 const bots = ["dependabot-preview[bot]", "greenkeeper[bot]", "greenkeeperio-bot"]
33
34 const authors = contributors
35 .filter((a) => !bots.includes(a.login))
36 .sort((a, b) => b.contributions - a.contributions)
37
38 const sprite = new Jimp(SIZE * authors.length, SIZE)
39
40 for (let i = 0; i < authors.length; i += 1) {
41 const author = authors[i]
42 console.log(`${i + 1} / ${authors.length}: ${author.login}`)
43 const image_data = await fetch(author.avatar_url)
44 const buffer = await image_data.arrayBuffer()
45 const image = await Jimp.read(buffer)
46 image.resize(SIZE, SIZE)
47 sprite.composite(image, i * SIZE, 0)
48 }
49
50 await sprite.quality(80).write(`../docs/.vuepress/components/Contributors/contributors.jpg`)
51
52 const str = `[\n ${authors.map((a) => `"${a.login}"`).join(",\n ")},\n]\n`
53
54 fs.writeFileSync(
55 `../docs/.vuepress/components/Contributors/_contributors.js`,
56 `module.exports = ${str}`
57 )
58}

Callers 1

Calls 1

logMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…