Skip to content

Commit

Permalink
Merge pull request #63 from oslabs-beta/export_deps
Browse files Browse the repository at this point in the history
refactor: how we import dependencies when importing Zoic
  • Loading branch information
hankthetank27 authored Jan 23, 2025
2 parents cae54da + b71ac9f commit 3c6ab75
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 340 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
src/tests/coverage_report/
src/tests/coverage_report/
deno.lock
26 changes: 11 additions & 15 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{
"name": "@hankthetank27/zoic",
"version": "1.0.6",
"license": "MIT",
"exports": "./zoic.ts",
"imports": {
"std/base64": "https://deno.land/std@0.89.0/encoding/base64.ts",
"std/asserts": "https://deno.land/std@0.224.0/testing/asserts.ts",
"std/bdd": "https://deno.land/std@0.224.0/testing/bdd.ts",
"oak": "https://deno.land/x/oak@v17.1.4/mod.ts",
"oak/application": "https://deno.land/x/oak@v17.1.4/application.ts",
"redis": "https://deno.land/x/redis@v0.37.1/mod.ts",
"redis/command": "https://deno.land/x/redis@v0.37.1/command.ts",
"cors": "https://deno.land/x/cors@v1.2.2/mod.ts"
}
}
"name": "Zoic",
"version": "1.0.7",
"description": "Caching middleware library for Oak",
"exports": {
".": "./zoic.ts"
},
"tasks": {
"test": "deno test ./src/tests/ --allow-net --allow-import"
},
"imports": {}
}
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 3c6ab75

Please sign in to comment.