Skip to content

Commit

Permalink
fix: use deps.ts instead of deno.json to inject dependencies
Browse files Browse the repository at this point in the history
deno.json will not work if we import zoic.ts directly so instead use deps.ts
where we define all external dependencies as exports
  • Loading branch information
unkn0wn-root committed Jan 23, 2025
1 parent 01e6fed commit 2db31f8
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 336 deletions.
12 changes: 0 additions & 12 deletions deno.json

This file was deleted.

308 changes: 0 additions & 308 deletions deno.lock

This file was deleted.

17 changes: 17 additions & 0 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export {
assert,
assertEquals,
assertInstanceOf,
assertThrows,
assertRejects,
assertExists
} from "https://deno.land/std@0.224.0/testing/asserts.ts";
export { decode as base64decode, encode as base64encode } from 'https://deno.land/std@0.89.0/encoding/base64.ts';
export { Context, Application, Router } from "https://deno.land/x/oak@v17.1.4/mod.ts";
export { connect } from "https://deno.land/x/redis@v0.37.1/mod.ts";
export { oakCors } from "https://deno.land/x/cors@v1.2.2/mod.ts";
export { describe, it } from "https://deno.land/std@0.224.0/testing/bdd.ts";

export type { ApplicationListenEvent } from "https://deno.land/x/oak@v17.1.4/application.ts";
export type { Redis } from "https://deno.land/x/redis@v0.37.1/mod.ts";

8 changes: 6 additions & 2 deletions src/tests/doublyLinkedList_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { assertEquals, assertExists } from "https://deno.land/std@0.224.0/testing/asserts.ts";
import { describe, it } from "https://deno.land/std@0.224.0/testing/bdd.ts";
import {
assertEquals,
assertExists,
describe,
it
} from "../../deps.ts";
import { ValueDoublyLinkedList, FreqDoublyLinkedList } from '../doublyLinkedLists.ts';

describe("ValDoublyLinkedList tests", () => {
Expand Down
8 changes: 6 additions & 2 deletions src/tests/lfu_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { assertEquals, assert } from "https://deno.land/std@0.224.0/testing/asserts.ts";
import { describe, it } from "https://deno.land/std@0.224.0/testing/bdd.ts";
import {
assertEquals,
assert,
describe,
it
} from "../../deps.ts";
import PerfMetrics from '../performanceMetrics.ts';
import LFU from '../lfu.ts'

Expand Down
8 changes: 6 additions & 2 deletions src/tests/lru_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { assertEquals, assert } from "std/asserts";
import { describe, it } from "std/bdd";
import {
assertEquals,
assert,
describe,
it
} from "../../deps.ts";
import PerfMetrics from '../performanceMetrics.ts';
import LRU from '../lru.ts'

Expand Down
7 changes: 5 additions & 2 deletions src/tests/performanceMetrics_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { assertEquals, assertInstanceOf } from "std/asserts";
import { Context } from "oak";
import {
assertEquals,
assertInstanceOf,
Context
} from "../../deps.ts";
import Zoic from '../../zoic.ts';
import PerfMetrics from '../performanceMetrics.ts';
import { TestServer } from './test_server.ts';
Expand Down
4 changes: 2 additions & 2 deletions src/tests/test_server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Application, Router } from "oak";
import type { ApplicationListenEvent } from "oak/application";
import { Application, Router } from "../../deps.ts";
import type { ApplicationListenEvent } from "../../deps.ts";

// Test server setup utility with proper cleanup
export class TestServer {
Expand Down
4 changes: 2 additions & 2 deletions src/tests/zoic_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
assertEquals,
assertInstanceOf,
assertRejects,
} from "std/asserts";
import { Context } from "oak";
Context
} from "../../deps.ts";
import Zoic from "../../zoic.ts";
import LRU from "../lru.ts";
import LFU from "../lfu.ts";
Expand Down
12 changes: 8 additions & 4 deletions zoic.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { decode as base64decode, encode as base64encode } from 'std/base64';
import { Context } from 'oak';
import { connect, Redis } from 'redis';
import { oakCors } from 'cors';
import {
base64decode,
base64encode,
Context,
connect,
oakCors
} from './deps.ts';
import type { Redis } from "./deps.ts";
import { options, cacheValue } from './src/types.ts'
import PerfMetrics from './src/performanceMetrics.ts'
import LRU from './src/lru.ts'
Expand Down

0 comments on commit 2db31f8

Please sign in to comment.