From a022c8a8adc458bb44a2dbc6010bb7b0b06465fd Mon Sep 17 00:00:00 2001 From: James Cook Date: Sat, 16 Sep 2023 20:14:18 +0100 Subject: [PATCH] chore: move deno dev deps to deps file && use import map --- deno.jsonc | 5 ++++- deps_dev.ts | 5 +++++ scripts/build_npm.ts | 1 + src/core/baseClient.ts | 2 +- src/core/parentClient.ts | 6 +++--- src/core/studentClient.ts | 6 +++--- src/core/studentClient_test.ts | 5 ++--- src/utils/utils_test.ts | 6 +----- 8 files changed, 20 insertions(+), 16 deletions(-) create mode 100644 deps_dev.ts diff --git a/deno.jsonc b/deno.jsonc index 175e392..f6d841b 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -2,5 +2,8 @@ "tasks": { "npm": "deno run -A scripts/build_npm.ts" }, - "exclude": ["npm"] + "exclude": ["npm"], + "imports": { + "~/": "./" + } } diff --git a/deps_dev.ts b/deps_dev.ts new file mode 100644 index 0000000..ac3dc72 --- /dev/null +++ b/deps_dev.ts @@ -0,0 +1,5 @@ +export { + assertEquals, + assertExists, + assertRejects, +} from "https://deno.land/std@0.200.0/assert/mod.ts"; diff --git a/scripts/build_npm.ts b/scripts/build_npm.ts index 036fea5..7155e06 100644 --- a/scripts/build_npm.ts +++ b/scripts/build_npm.ts @@ -13,6 +13,7 @@ await build({ path: "./src/types.ts", }], outDir: "./npm", + importMap: "./deno.jsonc", shims: { deno: true, }, diff --git a/src/core/baseClient.ts b/src/core/baseClient.ts index 9f4e93f..1aab7b4 100644 --- a/src/core/baseClient.ts +++ b/src/core/baseClient.ts @@ -16,7 +16,7 @@ import type { HomeworksResponse, LessonsResponse, } from "../types.ts"; -import { PING_INTERVAL } from "../utils/consts.ts"; +import { PING_INTERVAL } from "~/src/utils/consts.ts"; /** * Shared client for both parent and student. This is not exported and should not be used directly diff --git a/src/core/parentClient.ts b/src/core/parentClient.ts index c75a1d2..cc002a0 100644 --- a/src/core/parentClient.ts +++ b/src/core/parentClient.ts @@ -1,8 +1,8 @@ import type { GetPupilsResponse } from "../types.ts"; -import { BaseClient } from "./baseClient.ts"; -import { API_BASE_PARENT, BASE_URL } from "../utils/consts.ts"; -import { parseCookies } from "../utils/utils.ts"; +import { BaseClient } from "~/src/core/baseClient.ts"; +import { API_BASE_PARENT, BASE_URL } from "~/src/utils/consts.ts"; +import { parseCookies } from "~/src/utils/utils.ts"; /** * Parent Client */ diff --git a/src/core/studentClient.ts b/src/core/studentClient.ts index 464a22d..e21d0ba 100644 --- a/src/core/studentClient.ts +++ b/src/core/studentClient.ts @@ -1,6 +1,6 @@ -import { API_BASE_STUDENT, BASE_URL } from "../utils/consts.ts"; -import { BaseClient } from "./baseClient.ts"; -import { parseCookies } from "../utils/utils.ts"; +import { API_BASE_STUDENT, BASE_URL } from "~/src/utils/consts.ts"; +import { BaseClient } from "~/src/core/baseClient.ts"; +import { parseCookies } from "~/src/utils/utils.ts"; /** * Student Client diff --git a/src/core/studentClient_test.ts b/src/core/studentClient_test.ts index 6932a75..a5b000a 100644 --- a/src/core/studentClient_test.ts +++ b/src/core/studentClient_test.ts @@ -1,6 +1,5 @@ -import { assertRejects } from "https://deno.land/std@0.200.0/assert/mod.ts"; - -import { StudentClient } from "./studentClient.ts"; +import { assertRejects } from "~/deps_dev.ts"; +import { StudentClient } from "~/src/core/studentClient.ts"; Deno.test("Throws when no student code is provided", async () => { const client = new StudentClient(""); diff --git a/src/utils/utils_test.ts b/src/utils/utils_test.ts index 7ecfdff..ccb7696 100644 --- a/src/utils/utils_test.ts +++ b/src/utils/utils_test.ts @@ -1,8 +1,4 @@ -import { - assertEquals, - assertExists, -} from "https://deno.land/std@0.200.0/assert/mod.ts"; - +import { assertEquals, assertExists } from "~/deps_dev.ts"; import { parseCookies } from "./utils.ts"; Deno.test("Parses simple cookie", () => { const cookie =