diff --git a/convert.ts b/cmd/convert.ts similarity index 93% rename from convert.ts rename to cmd/convert.ts index 54fa180..8f61511 100644 --- a/convert.ts +++ b/cmd/convert.ts @@ -1,6 +1,6 @@ import { existsSync } from "fs"; -import { asyncLoadJSON, asyncSaveJSON } from "./utils"; +import { asyncLoadJSON, asyncSaveJSON } from "../lib"; interface JSONCard { mcmId: number; diff --git a/cmd/cube.ts b/cmd/cube.ts new file mode 100644 index 0000000..e69de29 diff --git a/fetch.ts b/cmd/fetch.ts similarity index 80% rename from fetch.ts rename to cmd/fetch.ts index 1069350..a4e503d 100644 --- a/fetch.ts +++ b/cmd/fetch.ts @@ -1,5 +1,4 @@ -import CardMarketApi from "./api"; -import { asyncSaveJSON } from "./utils"; +import { asyncSaveJSON, CardMarketApi } from "../lib"; async function run() { if (process.argv.length < 3) { diff --git a/find.ts b/cmd/find.ts similarity index 91% rename from find.ts rename to cmd/find.ts index c273b64..ab60920 100644 --- a/find.ts +++ b/cmd/find.ts @@ -1,7 +1,6 @@ import { existsSync } from "fs"; -import { Article, MCMDB } from "./types"; -import { asyncLoadJSON, asyncSaveJSON, leanArticle, leanCard } from "./utils"; +import { Article, asyncLoadJSON, asyncSaveJSON, leanArticle, leanCard, MCMDB } from "../lib"; async function run() { if (process.argv.length < 3) { diff --git a/api.ts b/lib/api.ts similarity index 98% rename from api.ts rename to lib/api.ts index f9d8f9b..ca752b2 100644 --- a/api.ts +++ b/lib/api.ts @@ -5,7 +5,7 @@ import { Article } from "./types"; const URI = "https://api.cardmarket.com/ws/v2.0/output.json"; -export default class CardMarketApi { +export class CardMarketApi { private AppToken: string; private AppSecret: string; private AccessToken: string; diff --git a/lib/index.ts b/lib/index.ts new file mode 100644 index 0000000..01c6c9d --- /dev/null +++ b/lib/index.ts @@ -0,0 +1,3 @@ +export * from "./api"; +export * from "./types"; +export * from "./utils"; diff --git a/types.ts b/lib/types.ts similarity index 100% rename from types.ts rename to lib/types.ts diff --git a/utils.ts b/lib/utils.ts similarity index 100% rename from utils.ts rename to lib/utils.ts diff --git a/package.json b/package.json index b82db64..9bb9842 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,9 @@ "author": "Hamcha ", "license": "MIT", "scripts": { - "fetch": "ts-node fetch.ts", - "init-db": "ts-node convert.ts", - "find": "ts-node find.ts" + "fetch": "ts-node cmd/fetch.ts", + "init-db": "ts-node cmd/convert.ts", + "find": "ts-node cmd/find.ts" }, "dependencies": { "@types/node": "^12.12.11",