repos / neovimcraft

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

commit
0aed6a1
parent
a1022b4
author
Eric Bower
date
2022-11-27 15:16:57 +0000 UTC
chore: reorg some ts files
10 files changed,  +40, -42
M Makefile
+7, -7
 1@@ -1,16 +1,16 @@
 2 dev:
 3-	deno run --allow-read --allow-net dev.ts
 4+	deno run --allow-read --allow-net src/dev.ts
 5 .PHONY: dev
 6 
 7 resource:
 8-	deno run --allow-write scripts/resource.ts
 9+	deno run --allow-write src/scripts/resource.ts
10 .PHONY: resource
11 
12 scrape:
13-	deno run --allow-write --allow-net scripts/scrape.ts
14-	deno run --allow-write scripts/patch.ts
15-	deno run --allow-write --allow-env --allow-net scripts/process.ts
16-	deno run --allow-write --allow-read scripts/html.ts
17+	deno run --allow-write --allow-net src/scripts/scrape.ts
18+	deno run --allow-write src/scripts/patch.ts
19+	deno run --allow-write --allow-env --allow-net src/scripts/process.ts
20+	deno run --allow-write --allow-read src/scripts/html.ts
21 .PHONY: scrape
22 
23 clean:
24@@ -22,7 +22,7 @@ clean:
25 .PHONY: clean
26 
27 build: clean
28-	deno run --allow-write scripts/static.ts
29+	deno run --allow-write src/scripts/static.ts
30 .PHONY: build
31 
32 upload:
M deno.json
+2, -2
 1@@ -1,7 +1,7 @@
 2 {
 3   "lint": {
 4     "files": {
 5-      "include": ["src/", "scripts/"]
 6+      "include": ["src/"]
 7     },
 8     "rules": {
 9       "tags": ["recommended"],
10@@ -10,7 +10,7 @@
11   },
12   "fmt": {
13     "files": {
14-      "include": ["src/", "scripts/"]
15+      "include": ["src/"]
16     }
17   }
18 }
A src/deps.ts
+3, -0
1@@ -0,0 +1,3 @@
2+export { marked } from "npm:marked";
3+export { encode } from "https://deno.land/std@0.166.0/encoding/base64.ts";
4+export { dirname } from "https://deno.land/std@0.166.0/path/mod.ts";
R dev.ts => src/dev.ts
+0, -0
R scripts/html.ts => src/scripts/html.ts
+5, -6
 1@@ -1,6 +1,5 @@
 2-import { marked } from "npm:marked";
 3-
 4-import type { Plugin } from "../src/types.ts";
 5+import { marked } from "../deps.ts";
 6+import type { Plugin } from "../types.ts";
 7 
 8 clean().catch(console.error);
 9 
10@@ -17,12 +16,12 @@ async function clean() {
11     marked.use({
12       walkTokens: (token: any) => {
13         const domain = "https://github.com";
14-        const pre =
15-          `${domain}/${plugin.username}/${plugin.repo}/blob/${plugin.branch}`;
16+        const pre = `${domain}/${plugin.username}/${plugin.repo}/blob/${plugin.branch}`;
17 
18         if (token.type === "link" || token.type === "image") {
19           if (
20-            token.href && !token.href.startsWith("http") &&
21+            token.href &&
22+            !token.href.startsWith("http") &&
23             !token.href.startsWith("#")
24           ) {
25             token.href = `${pre}/${token.href.replace("./", ``)}`;
R scripts/patch.ts => src/scripts/patch.ts
+3, -3
 1@@ -1,7 +1,7 @@
 2-import scrapeData from "../data/scrape.json" assert { type: "json" };
 3-import manualData from "../data/manual.json" assert { type: "json" };
 4+import scrapeData from "../../data/scrape.json" assert { type: "json" };
 5+import manualData from "../../data/manual.json" assert { type: "json" };
 6 
 7-import type { Resource, ResourceMap } from "../src/types.ts";
 8+import type { Resource, ResourceMap } from "../types.ts";
 9 
10 patch().then(console.log).catch(console.error);
11 
R scripts/process.ts => src/scripts/process.ts
+4, -5
 1@@ -1,9 +1,8 @@
 2-import { encode } from "https://deno.land/std/encoding/base64.ts";
 3+import resourceFile from "../../data/resources.json" assert { type: "json" };
 4 
 5-import resourceFile from "../data/resources.json" assert { type: "json" };
 6-
 7-import type { Plugin, Resource } from "../src/types.ts";
 8-import { createPlugin } from "../src/entities.ts";
 9+import { encode } from "../deps.ts";
10+import type { Plugin, Resource } from "../types.ts";
11+import { createPlugin } from "../entities.ts";
12 
13 const accessToken = Deno.env.get("GITHUB_ACCESS_TOKEN") || "";
14 const accessUsername = Deno.env.get("GITHUB_USERNAME") || "";
R scripts/resource.ts => src/scripts/resource.ts
+4, -4
 1@@ -1,8 +1,8 @@
 2-import resourceFile from "../data/resources.json" assert { type: "json" };
 3-import manualFile from "../data/manual.json" assert { type: "json" };
 4+import resourceFile from "../../data/resources.json" assert { type: "json" };
 5+import manualFile from "../../data/manual.json" assert { type: "json" };
 6 
 7-import type { Resource } from "../src/types.ts";
 8-import { createResource } from "../src/entities.ts";
 9+import type { Resource } from "../types.ts";
10+import { createResource } from "../entities.ts";
11 
12 async function init() {
13   const name = prompt("name (username/repo):") || "";
R scripts/scrape.ts => src/scripts/scrape.ts
+6, -8
 1@@ -1,7 +1,6 @@
 2-import { marked } from "npm:marked";
 3-
 4-import type { Resource } from "../src/types.ts";
 5-import { createResource } from "../src/entities.ts";
 6+import { marked } from "../deps.ts";
 7+import type { Resource } from "../types.ts";
 8+import { createResource } from "../entities.ts";
 9 
10 const URLS = [
11   "https://raw.githubusercontent.com/rockerBOO/awesome-neovim/main/README.md",
12@@ -60,10 +59,9 @@ function processMarkdown(text: string) {
13           // skip non-github links
14           if (!link.includes("github.com")) return;
15 
16-          const href = link.replace("https://github.com/", "").replace(
17-            "http://github.com",
18-            "",
19-          );
20+          const href = link
21+            .replace("https://github.com/", "")
22+            .replace("http://github.com", "");
23           const d = href.split("/");
24           resource.username = d[0];
25           resource.repo = d[1].replace(/#.+/, "");
R scripts/static.ts => src/scripts/static.ts
+6, -7
 1@@ -1,17 +1,16 @@
 2-import { dirname } from "https://deno.land/std/path/mod.ts";
 3+import dbFile from "../../data/db.json" assert { type: "json" };
 4+import htmlFile from "../../data/html.json" assert { type: "json" };
 5 
 6-import dbFile from "../data/db.json" assert { type: "json" };
 7-import htmlFile from "../data/html.json" assert { type: "json" };
 8-
 9-import { format, relativeTimeFromDates } from "../src/date.ts";
10-import { derivePluginData } from "../src/plugin-data.ts";
11+import { dirname } from "../deps.ts";
12+import { format, relativeTimeFromDates } from "../date.ts";
13+import { derivePluginData } from "../plugin-data.ts";
14 import type {
15   Plugin,
16   PluginData,
17   PluginMap,
18   Tag,
19   TagMap,
20-} from "../src/types.ts";
21+} from "../types.ts";
22 
23 async function createFile(fname: string, data: string) {
24   await Deno.mkdir(dirname(fname), { recursive: true });