- commit
- bea47a6
- parent
- 313d269
- author
- Eric Bower
- date
- 2022-12-14 21:21:45 +0000 UTC
fix: remove db.json from resource script since most users won't have it locally Closes: #212
1 files changed,
+6,
-13
+6,
-13
1@@ -1,21 +1,15 @@
2-import dbFile from "../../data/db.json" assert { type: "json" };
3 import resourceFile from "../../data/resources.json" assert { type: "json" };
4 import manualFile from "../../data/manual.json" assert { type: "json" };
5-import { derivePluginData } from "../plugin-data.ts";
6
7-import type { PluginMap, Resource } from "../types.ts";
8+import type { Resource } from "../types.ts";
9 import { createResource } from "../entities.ts";
10
11 const forges = ["github", "srht"];
12 const forgesStr = forges.join(",");
13
14 async function init() {
15- const pluginMap = (dbFile as any).plugins as PluginMap;
16- const pluginData = derivePluginData(pluginMap);
17- const allTags = pluginData.tags.map((t) => t.id);
18-
19- const type = prompt(`code forge [${forgesStr}] (default: github):`) ||
20- "github";
21+ const type =
22+ prompt(`code forge [${forgesStr}] (default: github):`) || "github";
23 if (!forges.includes(type)) {
24 throw new Error(`${type} is not a valid code forge, choose ${forgesStr}`);
25 }
26@@ -27,7 +21,7 @@ async function init() {
27 }
28
29 const foundResource = (resourceFile.resources as Resource[]).find(
30- (r) => `${r.username}/${r.repo}` === name,
31+ (r) => `${r.username}/${r.repo}` === name
32 );
33 if (foundResource) {
34 console.log(`${name} aleady found in resources, not adding`);
35@@ -35,9 +29,8 @@ async function init() {
36 }
37
38 console.log(
39- "\nNOTICE: Please review all current tags and see if any fit, only add new tags if absolutely necessary:\n",
40+ "\nNOTICE: Please review all current tags and see if any fit, only add new tags if absolutely necessary\n"
41 );
42- console.log(`[${allTags.join(", ")}]\n`);
43 const tagsRes = prompt("tags (comma separated):") || "";
44 const tags = tagsRes.split(",");
45
46@@ -47,7 +40,7 @@ async function init() {
47 username,
48 repo,
49 tags,
50- }),
51+ })
52 );
53
54 const json = JSON.stringify(manualFile, null, 2);