2024-02-27 07:50:03 +01:00
|
|
|
// projects count
|
2024-03-16 19:40:59 +01:00
|
|
|
const resp = await fetch(
|
|
|
|
"https://raw.githubusercontent.com/web3privacy/web3privacy/main/README.md",
|
|
|
|
);
|
2024-02-27 07:50:03 +01:00
|
|
|
const text = await resp.text();
|
2024-03-16 19:40:59 +01:00
|
|
|
const [_, count] = text.match(/([\d\+]+) privacy projects/);
|
2024-02-27 07:50:03 +01:00
|
|
|
|
|
|
|
// contributors
|
2024-03-16 19:40:59 +01:00
|
|
|
const response = await fetch(
|
|
|
|
`https://api.github.com/repos/web3privacy/web3privacy/contributors`,
|
|
|
|
);
|
2024-02-27 07:50:03 +01:00
|
|
|
const repoContributors = await response.json();
|
|
|
|
|
|
|
|
// stars
|
2024-03-16 19:40:59 +01:00
|
|
|
const respRepo = await fetch(
|
|
|
|
"https://api.github.com/repos/web3privacy/web3privacy",
|
|
|
|
);
|
2024-02-27 07:50:03 +01:00
|
|
|
const repo = await respRepo.json();
|
|
|
|
|
|
|
|
const data = {
|
2024-03-16 19:40:59 +01:00
|
|
|
count,
|
|
|
|
contributors: repoContributors.length,
|
|
|
|
stars: repo.stargazers_count,
|
|
|
|
};
|
2024-02-27 07:50:03 +01:00
|
|
|
|
|
|
|
await Deno.writeTextFile(
|
2024-03-16 19:40:59 +01:00
|
|
|
"./src/db-repo.json",
|
|
|
|
JSON.stringify(data, null, 2),
|
|
|
|
);
|
|
|
|
console.log(`File ./src/db-repo.json saved`);
|