Skip to content

Commit

Permalink
deps: migrate dependencies to jsr and npm (#440)
Browse files Browse the repository at this point in the history
Towards #438. This commit migrates dependencies from deno.land and esm.sh to jsr and npm.
  • Loading branch information
uki00a authored Jul 15, 2024
1 parent 1b5b1f1 commit 495ff80
Show file tree
Hide file tree
Showing 59 changed files with 78 additions and 244 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
path: |
~/.deno
~/.cache/deno
key: ${{ runner.os }}-deno-${{ hashFiles('**/import_map.json', '**/.deno-version', '**/modules-lock.json') }}
key: ${{ runner.os }}-deno-${{ hashFiles('deps/**', '.denov') }}
- name: Check mod.ts
run: |
deno task make_mod
Expand Down
2 changes: 1 addition & 1 deletion connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { Protocol as DenoStreamsProtocol } from "./protocol/deno_streams/mod.ts";
import type { Command, Protocol } from "./protocol/shared/protocol.ts";
import type { RedisReply, RedisValue } from "./protocol/shared/types.ts";
import { delay } from "./vendor/https/deno.land/std/async/delay.ts";
import { delay } from "./deps/std/async.ts";

export interface SendCommandOptions {
/**
Expand Down
1 change: 0 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"test:doc": "deno test --doc --no-run --import-map=import_map.test.json",
"coverage": "deno coverage ./coverage --lcov --output=coverage/lcov.info",
"make_mod": "deno run --allow-read --allow-write --allow-run --check tools/make_mod.ts",
"dlink": "deno run --allow-read=modules.json,modules-lock.json,vendor --allow-write=modules-lock.json,vendor --allow-net=deno.land,esm.sh https://deno.land/x/[email protected]/dlink.ts && deno fmt modules-lock.json vendor",
"bench:deno-redis": "DENO_NO_PACKAGE_JSON=1 deno run --unstable --allow-net=127.0.0.1:6379 --allow-read --allow-env --allow-write=tmp --import-map=benchmark/import_map.json benchmark/deno-redis.ts",
"bench:ioredis": "node benchmark/ioredis.js"
},
Expand Down
1 change: 1 addition & 0 deletions deps/cluster-key-slot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as calculateSlot } from "npm:[email protected]";
3 changes: 3 additions & 0 deletions deps/lodash-es.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { default as sample } from "npm:[email protected]/sample.js";
export { default as shuffle } from "npm:[email protected]/shuffle.js";
export { default as uniqBy } from "npm:[email protected]/uniqBy.js";
1 change: 1 addition & 0 deletions deps/std/assert.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "jsr:@std/[email protected]";
1 change: 1 addition & 0 deletions deps/std/async.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "jsr:@std/[email protected]";
1 change: 1 addition & 0 deletions deps/std/bytes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "jsr:@std/[email protected]";
1 change: 1 addition & 0 deletions deps/std/io.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "jsr:@std/[email protected]";
1 change: 1 addition & 0 deletions deps/std/streams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "jsr:@std/[email protected]";
1 change: 1 addition & 0 deletions deps/std/testing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "jsr:@std/[email protected]/bdd";
8 changes: 3 additions & 5 deletions experimental/cluster/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ import type { Connection, SendCommandOptions } from "../../connection.ts";
import type { Redis } from "../../redis.ts";
import type { RedisReply, RedisValue } from "../../protocol/shared/types.ts";
import { ErrorReplyError } from "../../errors.ts";
import { delay } from "../../vendor/https/deno.land/std/async/delay.ts";
import calculateSlot from "../../vendor/https/esm.sh/cluster-key-slot/lib/index.js";
import sample from "../../vendor/https/esm.sh/lodash-es/sample.js";
import shuffle from "../../vendor/https/esm.sh/lodash-es/shuffle.js";
import uniqBy from "../../vendor/https/esm.sh/lodash-es/uniqBy.js";
import { delay } from "../../deps/std/async.ts";
import { calculateSlot } from "../../deps/cluster-key-slot.js";
import { sample, shuffle, uniqBy } from "../../deps/lodash-es.js";

export interface ClusterConnectOptions {
nodes: Array<NodeOptions>;
Expand Down
5 changes: 1 addition & 4 deletions internal/buffered_readable_stream_test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { encoder } from "./encoding.ts";
import {
assertEquals,
assertRejects,
} from "../vendor/https/deno.land/std/assert/mod.ts";
import { assertEquals, assertRejects } from "../deps/std/assert.ts";
import { BufferedReadableStream } from "./buffered_readable_stream.ts";

Deno.test({
Expand Down
2 changes: 1 addition & 1 deletion internal/concate_bytes_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from "../vendor/https/deno.land/std/assert/mod.ts";
import { assertEquals } from "../deps/std/assert.ts";
import { concateBytes } from "./concate_bytes.ts";

Deno.test("concateBytes", () => {
Expand Down
29 changes: 0 additions & 29 deletions modules-lock.json

This file was deleted.

29 changes: 0 additions & 29 deletions modules.json

This file was deleted.

3 changes: 1 addition & 2 deletions protocol/deno_streams/command.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BufReader } from "../../vendor/https/deno.land/std/io/buf_reader.ts";
import { BufWriter } from "../../vendor/https/deno.land/std/io/buf_writer.ts";
import { BufReader, BufWriter } from "../../deps/std/io.ts";
import { readReply } from "./reply.ts";
import { ErrorReplyError } from "../../errors.ts";
import type { RedisReply, RedisValue } from "../shared/types.ts";
Expand Down
3 changes: 1 addition & 2 deletions protocol/deno_streams/mod.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BufReader } from "../../vendor/https/deno.land/std/io/buf_reader.ts";
import { BufWriter } from "../../vendor/https/deno.land/std/io/buf_writer.ts";
import { BufReader, BufWriter } from "../../deps/std/io.ts";
import { readReply } from "./reply.ts";
import { sendCommand, sendCommands, writeCommand } from "./command.ts";

Expand Down
2 changes: 1 addition & 1 deletion protocol/deno_streams/reply.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BufReader } from "../../vendor/https/deno.land/std/io/buf_reader.ts";
import { BufReader } from "../../deps/std/io.ts";
import type * as types from "../shared/types.ts";
import {
ArrayReplyCode,
Expand Down
2 changes: 1 addition & 1 deletion protocol/shared/command.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { concat } from "../../vendor/https/deno.land/std/bytes/concat.ts";
import { concat } from "../../deps/std/bytes.ts";
import { encoder } from "../../internal/encoding.ts";
import type { RedisValue } from "./types.ts";
import type { Command } from "./protocol.ts";
Expand Down
2 changes: 1 addition & 1 deletion protocol/shared/command_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { encodeCommand } from "./command.ts";
import { assertEquals } from "../../vendor/https/deno.land/std/assert/mod.ts";
import { assertEquals } from "../../deps/std/assert.ts";

Deno.test({
name: "encodeCommand",
Expand Down
2 changes: 1 addition & 1 deletion protocol/web_streams/reply_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from "../../vendor/https/deno.land/std/assert/mod.ts";
import { assertEquals } from "../../deps/std/assert.ts";
import { readReply } from "./reply.ts";
import { BufferedReadableStream } from "../../internal/buffered_readable_stream.ts";

Expand Down
4 changes: 2 additions & 2 deletions tests/backoff_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertEquals } from "../vendor/https/deno.land/std/assert/mod.ts";
import { describe, it } from "../vendor/https/deno.land/std/testing/bdd.ts";
import { assertEquals } from "../deps/std/assert.ts";
import { describe, it } from "../deps/std/testing.ts";

import { exponentialBackoff } from "../backoff.ts";

Expand Down
6 changes: 3 additions & 3 deletions tests/client_test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import type { Redis } from "../redis.ts";
import { delay } from "../vendor/https/deno.land/std/async/delay.ts";
import { delay } from "../deps/std/async.ts";
import {
assert,
assertEquals,
assertRejects,
assertThrows,
} from "../vendor/https/deno.land/std/assert/mod.ts";
} from "../deps/std/assert.ts";
import {
afterAll,
afterEach,
beforeAll,
beforeEach,
describe,
it,
} from "../vendor/https/deno.land/std/testing/bdd.ts";
} from "../deps/std/testing.ts";
import { newClient, nextPort, startRedis, stopRedis } from "./test_util.ts";
import type { TestServer } from "./test_util.ts";

Expand Down
8 changes: 4 additions & 4 deletions tests/cluster/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import {
assertArrayIncludes,
assertEquals,
assertRejects,
} from "../../vendor/https/deno.land/std/assert/mod.ts";
} from "../../deps/std/assert.ts";
import {
afterAll,
afterEach,
beforeAll,
describe,
it,
} from "../../vendor/https/deno.land/std/testing/bdd.ts";
import sample from "../../vendor/https/esm.sh/lodash-es/sample.js";
import calculateSlot from "../../vendor/https/esm.sh/cluster-key-slot/lib/index.js";
} from "../../deps/std/testing.ts";
import { sample } from "../../deps/lodash-es.js";
import { calculateSlot } from "../../deps/cluster-key-slot.js";
import { ErrorReplyError } from "../../errors.ts";
import { connect, create } from "../../redis.ts";
import type { CommandExecutor } from "../../executor.ts";
Expand Down
6 changes: 3 additions & 3 deletions tests/cluster/test_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
stopRedis,
} from "../test_util.ts";
import type { TestServer } from "../test_util.ts";
import { readAll } from "../../vendor/https/deno.land/std/io/read_all.ts";
import { readerFromStreamReader } from "../../vendor/https/deno.land/std/streams/reader_from_stream_reader.ts";
import { delay } from "../../vendor/https/deno.land/std/async/delay.ts";
import { readAll } from "../../deps/std/io.ts";
import { readerFromStreamReader } from "../../deps/std/streams.ts";
import { delay } from "../../deps/std/async.ts";

export interface TestCluster {
servers: TestServer[];
Expand Down
9 changes: 2 additions & 7 deletions tests/cluster_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@ import {
assert,
assertEquals,
assertStringIncludes,
} from "../vendor/https/deno.land/std/assert/mod.ts";
import {
afterAll,
beforeAll,
describe,
it,
} from "../vendor/https/deno.land/std/testing/bdd.ts";
} from "../deps/std/assert.ts";
import { afterAll, beforeAll, describe, it } from "../deps/std/testing.ts";
import { newClient, nextPort, startRedis, stopRedis } from "./test_util.ts";
import type { TestServer } from "./test_util.ts";

Expand Down
9 changes: 2 additions & 7 deletions tests/commands/acl.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { assertEquals } from "../../vendor/https/deno.land/std/assert/mod.ts";
import {
afterAll,
beforeAll,
describe,
it,
} from "../../vendor/https/deno.land/std/testing/bdd.ts";
import { assertEquals } from "../../deps/std/assert.ts";
import { afterAll, beforeAll, describe, it } from "../../deps/std/testing.ts";
import type { Connector, TestServer } from "../test_util.ts";
import type { Redis } from "../../mod.ts";

Expand Down
15 changes: 3 additions & 12 deletions tests/commands/connection.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import { createLazyClient } from "../../mod.ts";
import {
assert,
assertEquals,
assertExists,
} from "../../vendor/https/deno.land/std/assert/mod.ts";
import {
afterAll,
beforeAll,
describe,
it,
} from "../../vendor/https/deno.land/std/testing/bdd.ts";
import { delay } from "../../vendor/https/deno.land/std/async/delay.ts";
import { assert, assertEquals, assertExists } from "../../deps/std/assert.ts";
import { afterAll, beforeAll, describe, it } from "../../deps/std/testing.ts";
import { delay } from "../../deps/std/async.ts";
import type { Connector, TestServer } from "../test_util.ts";
import type { Redis } from "../../mod.ts";

Expand Down
7 changes: 2 additions & 5 deletions tests/commands/general.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { ErrorReplyError } from "../../mod.ts";
import type { Redis } from "../../mod.ts";
import {
assertEquals,
assertRejects,
} from "../../vendor/https/deno.land/std/assert/mod.ts";
import { assertEquals, assertRejects } from "../../deps/std/assert.ts";
import {
afterAll,
beforeAll,
beforeEach,
describe,
it,
} from "../../vendor/https/deno.land/std/testing/bdd.ts";
} from "../../deps/std/testing.ts";
import type { Connector, TestServer } from "../test_util.ts";

export function generalTests(
Expand Down
8 changes: 2 additions & 6 deletions tests/commands/geo.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { assertEquals } from "../../vendor/https/deno.land/std/assert/mod.ts";
import {
afterAll,
beforeAll,
it,
} from "../../vendor/https/deno.land/std/testing/bdd.ts";
import { assertEquals } from "../../deps/std/assert.ts";
import { afterAll, beforeAll, it } from "../../deps/std/testing.ts";
import type { Connector, TestServer } from "../test_util.ts";
import type { Redis } from "../../mod.ts";

Expand Down
9 changes: 2 additions & 7 deletions tests/commands/hash.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { assertEquals } from "../../vendor/https/deno.land/std/assert/mod.ts";
import {
afterAll,
beforeAll,
beforeEach,
it,
} from "../../vendor/https/deno.land/std/testing/bdd.ts";
import { assertEquals } from "../../deps/std/assert.ts";
import { afterAll, beforeAll, beforeEach, it } from "../../deps/std/testing.ts";
import type { Connector, TestServer } from "../test_util.ts";
import type { Redis } from "../../mod.ts";

Expand Down
8 changes: 2 additions & 6 deletions tests/commands/hyper_loglog.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { assertEquals } from "../../vendor/https/deno.land/std/assert/mod.ts";
import {
afterAll,
beforeAll,
it,
} from "../../vendor/https/deno.land/std/testing/bdd.ts";
import { assertEquals } from "../../deps/std/assert.ts";
import { afterAll, beforeAll, it } from "../../deps/std/testing.ts";
import type { Connector, TestServer } from "../test_util.ts";
import type { Redis } from "../../mod.ts";

Expand Down
9 changes: 2 additions & 7 deletions tests/commands/key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ import {
assert,
assertArrayIncludes,
assertEquals,
} from "../../vendor/https/deno.land/std/assert/mod.ts";
import {
afterAll,
beforeAll,
beforeEach,
it,
} from "../../vendor/https/deno.land/std/testing/bdd.ts";
} from "../../deps/std/assert.ts";
import { afterAll, beforeAll, beforeEach, it } from "../../deps/std/testing.ts";
import type { Connector, TestServer } from "../test_util.ts";
import type { Redis } from "../../mod.ts";

Expand Down
9 changes: 2 additions & 7 deletions tests/commands/list.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { assertEquals } from "../../vendor/https/deno.land/std/assert/mod.ts";
import {
afterAll,
beforeAll,
beforeEach,
it,
} from "../../vendor/https/deno.land/std/testing/bdd.ts";
import { assertEquals } from "../../deps/std/assert.ts";
import { afterAll, beforeAll, beforeEach, it } from "../../deps/std/testing.ts";
import type { Connector, TestServer } from "../test_util.ts";
import type { Redis } from "../../mod.ts";

Expand Down
7 changes: 2 additions & 5 deletions tests/commands/pipeline.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { ErrorReplyError, Raw } from "../../mod.ts";
import {
assert,
assertEquals,
} from "../../vendor/https/deno.land/std/assert/mod.ts";
import { it } from "../../vendor/https/deno.land/std/testing/bdd.ts";
import { assert, assertEquals } from "../../deps/std/assert.ts";
import { it } from "../../deps/std/testing.ts";
import type { Connector, TestServer } from "../test_util.ts";

export function pipelineTests(
Expand Down
10 changes: 3 additions & 7 deletions tests/commands/pubsub.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { delay } from "../../vendor/https/deno.land/std/async/delay.ts";
import {
assert,
assertEquals,
assertRejects,
} from "../../vendor/https/deno.land/std/assert/mod.ts";
import { describe, it } from "../../vendor/https/deno.land/std/testing/bdd.ts";
import { delay } from "../../deps/std/async.ts";
import { assert, assertEquals, assertRejects } from "../../deps/std/assert.ts";
import { describe, it } from "../../deps/std/testing.ts";
import { nextPort, startRedis, stopRedis } from "../test_util.ts";
import type { Connector, TestServer } from "../test_util.ts";

Expand Down
Loading

0 comments on commit 495ff80

Please sign in to comment.