repos / neovimcraft

website that makes it easy to find neovim plugins
git clone https://github.com/neurosnap/neovimcraft.git

commit
8c51069
parent
1aabed0
author
Eric Bower
date
2023-04-12 02:40:00 +0000 UTC
chore(configs): create deny list and filter them out
3 files changed,  +14, -10
A src/filter.ts
+3, -0
1@@ -0,0 +1,3 @@
2+export const denyRepos = [
3+  "wbthomason/packer.nvim",
4+];
M src/github.ts
+1, -1
1@@ -33,7 +33,7 @@ async function githubApi<D = any>(
2     const RESET_BUFFER = 500;
3     const wait = (rateLimitReset * 1000) + RESET_BUFFER - now;
4     // ms -> s -> min
5-    const mins = Math.ceil(wait / 1000 / 60)
6+    const mins = Math.ceil(wait / 1000 / 60);
7     console.log(
8       `Hit github rate limit, waiting ${mins} mins`,
9     );
M src/scripts/scrape-config.ts
+10, -9
 1@@ -1,6 +1,7 @@
 2 import { fetchTopics, ghToken } from "../github.ts";
 3 import { createResource, getResourceId } from "../entities.ts";
 4 import { ResourceMap } from "../types.ts";
 5+import { denyRepos } from "../filter.ts";
 6 
 7 init().catch(console.error);
 8 
 9@@ -29,16 +30,16 @@ async function save(resources: ResourceMap) {
10 
11 async function dl(resources: ResourceMap, topic: string) {
12   const repos = await fetchTopics(topic, ghToken);
13-
14   console.log(`${topic} found ${repos.length} repos`);
15-  const resourceList = repos.map((repo) => {
16-    const [username, repoName] = repo.full_name.split("/");
17-    return createResource({
18-      username,
19-      repo: repoName,
20-      tags: repo.topics,
21-    });
22-  });
23+  const resourceList = repos
24+    .map((repo) => {
25+      const [username, repoName] = repo.full_name.split("/");
26+      return createResource({
27+        username,
28+        repo: repoName,
29+        tags: repo.topics,
30+      });
31+    }).filter((repo) => !denyRepos.includes(getResourceId(repo)));
32   const newResources = resourceList.reduce<ResourceMap>((acc, repo) => {
33     acc[getResourceId(repo)] = repo;
34     return acc;