mirror of
https://github.com/hanzoai/vitest.git
synced 2026-10-30 14:46:34 +00:00
Co-authored-by: marchantweb <[email protected]> Co-authored-by: mdong1909 <[email protected]> Co-authored-by: Hiroshi Ogawa <[email protected]> Co-authored-by: Vladimir Sheremet <[email protected]> Co-authored-by: Michael Dong <[email protected]> Co-authored-by: Ujjwaljain16 <[email protected]> Co-authored-by: sheremet-va <[email protected]> Co-authored-by: hi-ogawa <[email protected]> Co-authored-by: Ari Perkkiƶ <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Carlo Jeske <[email protected]> Co-authored-by: Hanzo Dev <[email protected]>
31 lines
942 B
TypeScript
31 lines
942 B
TypeScript
import { existsSync, promises as fsp } from 'node:fs'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { dirname, join, resolve } from 'pathe'
|
|
import { teamEmeritiMembers, teamMembers } from '../contributors'
|
|
|
|
const docsDir = resolve(dirname(fileURLToPath(import.meta.url)), '../..')
|
|
const dirAvatars = resolve(docsDir, 'public/user-avatars/')
|
|
|
|
async function download(url: string, fileName: string) {
|
|
if (existsSync(fileName)) {
|
|
return
|
|
}
|
|
|
|
console.log('downloading', fileName)
|
|
try {
|
|
const image = await (await fetch(url)).arrayBuffer()
|
|
await fsp.writeFile(fileName, Buffer.from(image))
|
|
}
|
|
catch {}
|
|
}
|
|
|
|
async function fetchAvatars() {
|
|
if (!existsSync(dirAvatars)) {
|
|
await fsp.mkdir(dirAvatars, { recursive: true })
|
|
}
|
|
|
|
await Promise.all([...teamEmeritiMembers, ...teamMembers].map(c => c.github).map(name => download(`https://github.com/${name}.png?size=100`, join(dirAvatars, `${name}.png`))))
|
|
}
|
|
|
|
fetchAvatars()
|