Skip to content

Commit

Permalink
chore: add JSR imports to deno.json and fmt/lint
Browse files Browse the repository at this point in the history
  • Loading branch information
eliassjogreen committed Apr 9, 2024
1 parent 7a6f45f commit 0131e5f
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 39 deletions.
6 changes: 6 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@
"./download": "./download.ts",
"./util": "./util.ts"
},
"imports": {
"@std/encoding/hex": "jsr:@std/encoding@^0.221.0/hex",
"@std/fmt/colors": "jsr:@std/fmt@^0.221.0/colors",
"@std/fs": "jsr:@std/fs@^0.221.0",
"@std/path": "jsr:@std/path@^0.221.0"
},
"lock": false
}
13 changes: 0 additions & 13 deletions deps.ts

This file was deleted.

8 changes: 4 additions & 4 deletions download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

import {
dirname,
ensureDir,
extname,
fromFileUrl,
green,
join,
normalize,
resolve,
} from "./deps.ts";
import {
} from "@std/path";
import { ensureDir } from "@std/fs";
import { green } from "@std/fmt/colors";
import type {
ArchRecord,
CacheLocation,
FetchOptions,
Expand Down
7 changes: 3 additions & 4 deletions download_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import {
assertEquals,
assertMatch,
assertRejects,
basename,
dirname,
normalize,
} from "./test_deps.ts";
} from "jsr:@std/assert";
import { basename, dirname, normalize } from "@std/path";

import { createDownloadURL, ensureCacheLocation } from "./download.ts";

const ALL_ARCHS = ["x86_64", "aarch64"];
Expand Down
2 changes: 0 additions & 2 deletions test_deps.ts

This file was deleted.

7 changes: 6 additions & 1 deletion test_import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"@denosaurs/plug": "./mod.ts",
"@denosaurs/plug/types": "./types.ts",
"@denosaurs/plug/download": "./download.ts",
"@denosaurs/plug/util": "./util.ts"
"@denosaurs/plug/util": "./util.ts",
"@std/assert": "jsr:@std/assert@^0.221.0",
"@std/encoding/hex": "jsr:@std/encoding@^0.221.0/hex",
"@std/fmt/colors": "jsr:@std/fmt@^0.221.0/colors",
"@std/fs": "jsr:@std/fs@^0.221.0",
"@std/path": "jsr:@std/path@^0.221.0"
}
}
12 changes: 3 additions & 9 deletions util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@
* @module
*/

import {
hex,
isAbsolute,
join,
normalize,
resolve,
toFileUrl,
} from "./deps.ts";
import { isAbsolute, join, normalize, resolve, toFileUrl } from "@std/path";
import { encodeHex } from "@std/encoding/hex";

const encoder = new TextEncoder();

Expand Down Expand Up @@ -61,7 +55,7 @@ export function stringToURL(url: string): URL {
* @private
*/
export async function hash(value: string): Promise<string> {
return hex(
return encodeHex(
new Uint8Array(
await crypto.subtle.digest("SHA-256", encoder.encode(value)),
),
Expand Down
9 changes: 3 additions & 6 deletions util_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ import {
assertEquals,
assertRejects,
assertThrows,
basename,
dirname,
fromFileUrl,
join,
normalize,
} from "./test_deps.ts";
} from "jsr:@std/assert";
import { basename, dirname, fromFileUrl, join, normalize } from "@std/path";

import {
cacheDir,
denoCacheDir,
Expand Down

0 comments on commit 0131e5f

Please sign in to comment.