Skip to content

Commit

Permalink
Merge pull request #3 from arnim279/remove-import-map
Browse files Browse the repository at this point in the history
Remove usages of import map
  • Loading branch information
arnimattr authored Jan 2, 2023
2 parents 0bffbae + 54364bc commit ac568db
Show file tree
Hide file tree
Showing 31 changed files with 47 additions and 47 deletions.
3 changes: 0 additions & 3 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"importMap": "import_map.json",

"lint": {
"files": { "exclude": ["npm"] },
"rules": {
Expand All @@ -10,7 +8,6 @@
"explicit-function-return-type",
"explicit-module-boundary-types",
"eqeqeq",
"no-external-import",
"ban-untagged-todo"
]
}
Expand Down
3 changes: 3 additions & 0 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "https://deno.land/[email protected]/testing/asserts.ts";
export * from "https://deno.land/[email protected]/datetime/mod.ts";
export * from "https://deno.land/[email protected]/http/mod.ts";
8 changes: 0 additions & 8 deletions import_map.json

This file was deleted.

2 changes: 1 addition & 1 deletion lib/datetime/Time.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TimeUnits } from "./TimeUnits.ts";
import { assert } from "std/testing/asserts.ts";
import { assert } from "../../deps.ts";

/** Helper for comparing the start and end times of lessons. By no means a replacement for {@link Date}. */
export class Time {
Expand Down
2 changes: 1 addition & 1 deletion lib/datetime/Time_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "std/testing/asserts.ts";
import { assert } from "../../deps.ts";
import { Time } from "./mod.ts";

Deno.test("Time.selectEarlier() - should work with different hours", () => {
Expand Down
2 changes: 1 addition & 1 deletion lib/datetime/untis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { format, parse } from "std/datetime/mod.ts";
import { format, parse } from "../../deps.ts";
import { Time } from "./Time.ts";

/** Parse a date from the WebUntis API into a JS Date object using local time. */
Expand Down
2 changes: 1 addition & 1 deletion lib/jsonrpc/RpcClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getSetCookies } from "std/http/mod.ts";
import { getSetCookies } from "../../deps.ts";
import { log } from "./requestLogger.ts";

type RpcRequest = {
Expand Down
2 changes: 1 addition & 1 deletion mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export {
type requestLogger,
RpcError,
setRequestLogger,
} from "lib/jsonrpc/mod.ts";
} from "./lib/jsonrpc/mod.ts";
export * from "./src/wrappers/mod.ts";
export * from "./src/searchSchools.ts";
export * from "./src/UntisClient.ts";
6 changes: 5 additions & 1 deletion scripts/build_npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ await build({

// Needed for fetch() and other modern APIs
compilerOptions: {
lib: ["dom", "dom.iterable"],
target: "ES2021",
lib: ["esnext", "dom", "dom.iterable"],
},

// Technically not needed
Expand All @@ -41,6 +42,9 @@ await build({
engines: {
node: ">=18",
},
devDependencies: {
"@types/node": "^17",
},
},
});

Expand Down
8 changes: 4 additions & 4 deletions src/UntisClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RpcClient, RpcError } from "lib/jsonrpc/mod.ts";
import { formatUntisDate } from "lib/datetime/untis.ts";
import * as requests from "webuntis/requests";
import { ElementType } from "webuntis/resources";
import { RpcClient, RpcError } from "../lib/jsonrpc/mod.ts";
import { formatUntisDate } from "../lib/datetime/untis.ts";
import * as requests from "./webuntis/requests/mod.ts";
import { ElementType } from "./webuntis/resources/mod.ts";
import {
Class,
Holiday,
Expand Down
4 changes: 2 additions & 2 deletions src/searchSchools.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RpcClient, RpcError } from "lib/jsonrpc/mod.ts";
import { ErrorCode, searchSchool } from "webuntis/requests";
import { RpcClient, RpcError } from "../lib/jsonrpc/mod.ts";
import { ErrorCode, searchSchool } from "./webuntis/requests/mod.ts";
import { School } from "./wrappers/mod.ts";

const rpcClient = new RpcClient("https://mobile.webuntis.com/ms/schoolquery2");
Expand Down
2 changes: 1 addition & 1 deletion src/webuntis/requests/authenticate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ElementType } from "webuntis/resources";
import { ElementType } from "../resources/mod.ts";

export const method = "authenticate";

Expand Down
2 changes: 1 addition & 1 deletion src/webuntis/requests/getClasses.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { schoolClass } from "webuntis/resources";
import { schoolClass } from "../resources/mod.ts";

export const method = "getKlassen";

Expand Down
2 changes: 1 addition & 1 deletion src/webuntis/requests/getCurrentSchoolyear.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { schoolyear } from "webuntis/resources";
import { schoolyear } from "../resources/mod.ts";

export const method = "getCurrentSchoolyear";

Expand Down
2 changes: 1 addition & 1 deletion src/webuntis/requests/getHolidays.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { holiday } from "webuntis/resources";
import { holiday } from "../resources/mod.ts";

export const method = "getHolidays";

Expand Down
2 changes: 1 addition & 1 deletion src/webuntis/requests/getRooms.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { room } from "webuntis/resources";
import { room } from "../resources/mod.ts";

export const method = "getRooms";

Expand Down
2 changes: 1 addition & 1 deletion src/webuntis/requests/getSchoolyears.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { schoolyear } from "webuntis/resources";
import { schoolyear } from "../resources/mod.ts";

export const method = "getSchoolyears";

Expand Down
2 changes: 1 addition & 1 deletion src/webuntis/requests/getStudents.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { student } from "webuntis/resources";
import { student } from "../resources/mod.ts";

export const method = "getStudents";

Expand Down
2 changes: 1 addition & 1 deletion src/webuntis/requests/getSubjects.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { subject } from "webuntis/resources";
import { subject } from "../resources/mod.ts";

export const method = "getSubjects";

Expand Down
2 changes: 1 addition & 1 deletion src/webuntis/requests/getTeachers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { teacher } from "webuntis/resources";
import { teacher } from "../resources/mod.ts";

export const method = "getTeachers";

Expand Down
2 changes: 1 addition & 1 deletion src/webuntis/requests/getTimetable.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ElementType, lesson } from "webuntis/resources";
import { ElementType, lesson } from "../resources/mod.ts";

export const method = "getTimetable";

Expand Down
2 changes: 1 addition & 1 deletion src/webuntis/requests/searchSchool.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { school } from "webuntis/resources";
import { school } from "../resources/mod.ts";

export const method = "searchSchool";

Expand Down
4 changes: 2 additions & 2 deletions src/wrappers/Holiday.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { holiday } from "webuntis/resources";
import { parseUntisDate } from "lib/datetime/untis.ts";
import { parseUntisDate } from "../../lib/datetime/untis.ts";
import { holiday } from "../webuntis/resources/mod.ts";

/** Wrapper around the holiday object. */
export class Holiday {
Expand Down
8 changes: 6 additions & 2 deletions src/wrappers/Lesson.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { parseUntisDate, parseUntisTime, Time } from "lib/datetime/mod.ts";
import { lesson } from "webuntis/resources";
import {
parseUntisDate,
parseUntisTime,
Time,
} from "../../lib/datetime/mod.ts";
import { lesson } from "../webuntis/resources/mod.ts";
import { LessonElementCollection } from "./LessonElementCollection.ts";
import { Schedule } from "./Schedule.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/wrappers/LessonElement.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { lessonElement } from "webuntis/resources";
import { lessonElement } from "../webuntis/resources/mod.ts";

/** Wrapper around an element included in a {@link Lesson}. */
export class LessonElement {
Expand Down
2 changes: 1 addition & 1 deletion src/wrappers/LessonElementCollection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { lesson } from "webuntis/resources";
import { lesson } from "../webuntis/resources/mod.ts";
import { LessonElement } from "./LessonElement.ts";

/** Represents a collection of elements included in a lesson. */
Expand Down
2 changes: 1 addition & 1 deletion src/wrappers/Schedule.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Time } from "lib/datetime/mod.ts";
import { Time } from "../../lib/datetime/mod.ts";
import { Lesson } from "./Lesson.ts";

/**
Expand Down
4 changes: 2 additions & 2 deletions src/wrappers/ScheduleCollection_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert } from "std/testing/asserts.ts";
import { Time } from "lib/datetime/mod.ts";
import { assert } from "../../deps.ts";
import { Time } from "../../lib/datetime/mod.ts";
import {
Lesson,
LessonElement,
Expand Down
2 changes: 1 addition & 1 deletion src/wrappers/School.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { school } from "webuntis/resources";
import { school } from "../webuntis/resources/mod.ts";
import { UntisClient } from "../UntisClient.ts";

/** Wrapper around the school object. */
Expand Down
4 changes: 2 additions & 2 deletions src/wrappers/Schoolyear.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { schoolyear } from "webuntis/resources";
import { parseUntisDate } from "lib/datetime/mod.ts";
import { schoolyear } from "../webuntis/resources/mod.ts";
import { parseUntisDate } from "../../lib/datetime/mod.ts";

/** Wrapper around the schoolyear object. */
export class Schoolyear {
Expand Down
2 changes: 1 addition & 1 deletion src/wrappers/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type {
student as Student,
subject as Subject,
teacher as Teacher,
} from "webuntis/resources";
} from "../webuntis/resources/mod.ts";
export * from "./Holiday.ts";
export * from "./LoginStatus.ts";
export * from "./Lesson.ts";
Expand Down

0 comments on commit ac568db

Please sign in to comment.