Skip to content
This repository was archived by the owner on Jul 7, 2024. It is now read-only.

Commit 68b2707

Browse files
authored
Merge pull request #24 from lambdalisue/upgrade-support-deno
💥 Upgrade support Deno version
2 parents c9f5cb9 + 0a03c2e commit 68b2707

File tree

9 files changed

+62
-64
lines changed

9 files changed

+62
-64
lines changed

.github/workflows/test.yml

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: Test
22

3-
env:
4-
DENO_VERSION: 1.x
5-
63
on:
74
schedule:
85
- cron: "0 7 * * 0"
@@ -14,46 +11,47 @@ on:
1411
- main
1512

1613
jobs:
17-
lint:
18-
runs-on: ubuntu-latest
19-
steps:
20-
- uses: actions/checkout@v2
21-
- uses: denoland/setup-deno@main
22-
with:
23-
deno-version: ${{ env.DENO_VERSION }}
24-
- name: Lint
25-
run: deno lint
26-
27-
format:
28-
runs-on: ubuntu-latest
14+
check:
15+
strategy:
16+
matrix:
17+
runner:
18+
- ubuntu-latest
19+
version:
20+
- "1.x"
21+
- "1.22.x"
22+
runs-on: ${{ matrix.runner }}
2923
steps:
30-
- uses: actions/checkout@v2
31-
- uses: denoland/setup-deno@main
24+
- uses: actions/checkout@v3
25+
- uses: denoland/setup-deno@v1
3226
with:
33-
deno-version: ${{ env.DENO_VERSION }}
34-
- name: Format
27+
deno-version: "${{ matrix.version }}"
28+
- name: Lint check
29+
run: |
30+
make lint
31+
- name: Format check
32+
run: |
33+
make fmt-check
34+
- name: Type check
3535
run: |
36-
deno fmt --check
36+
make type-check
3737
3838
test:
39-
runs-on: ubuntu-latest
39+
strategy:
40+
matrix:
41+
runner:
42+
- windows-latest
43+
- macos-latest
44+
- ubuntu-latest
45+
version:
46+
- "1.x"
47+
- "1.22.x"
48+
runs-on: ${{ matrix.runner }}
4049
steps:
41-
- uses: actions/checkout@v2
42-
- uses: denoland/setup-deno@main
50+
- uses: actions/checkout@v3
51+
- uses: denoland/setup-deno@v1
4352
with:
44-
deno-version: ${{ env.DENO_VERSION }}
53+
deno-version: "${{ matrix.version }}"
4554
- name: Test
4655
run: |
47-
deno test
56+
make test
4857
timeout-minutes: 5
49-
50-
typecheck:
51-
runs-on: ubuntu-latest
52-
steps:
53-
- uses: actions/checkout@v2
54-
- uses: denoland/setup-deno@main
55-
with:
56-
deno-version: ${{ env.DENO_VERSION }}
57-
- name: Type check
58-
run: |
59-
deno test --unstable --no-run ./*.ts

.github/workflows/udd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
udd:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v3
1313
- uses: denoland/setup-deno@v1
1414
with:
1515
deno-version: "1.x"
@@ -35,7 +35,7 @@ jobs:
3535
${{ steps.log.outputs.content }}
3636
3737
EOM
38-
- uses: peter-evans/create-pull-request@v3
38+
- uses: peter-evans/create-pull-request@v4
3939
with:
4040
title: ":package: Update Deno dependencies"
4141
body: |

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ help:
88
perl -pe 's/(.*):.*##\s*/sprintf("%-20s",$$1)/eg;'
99

1010
fmt: FORCE ## Format code
11-
@deno fmt --ignore=.deno
11+
@deno fmt
1212

1313
fmt-check: FORCE ## Format check
14-
@deno fmt --check --ignore=.deno
14+
@deno fmt --check
1515

1616
lint: FORCE ## Lint code
17-
@deno lint --ignore=.deno
17+
@deno lint
1818

1919
type-check: FORCE ## Type check
20-
@deno test --unstable --no-run ${TARGETS}
20+
@deno test --no-run ${TARGETS}
2121

2222
test: FORCE ## Test
23-
@deno test --unstable -A --no-check --jobs
23+
@deno test -A --no-check
2424

2525
deps: FORCE ## Update dependencies
2626
@deno run -A https://deno.land/x/[email protected]/main.ts ${TARGETS}

deps.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export { decodeStream, encode } from "https://deno.land/x/[email protected]/mod.ts";
2-
export { deferred, delay } from "https://deno.land/x/std@0.110.0/async/mod.ts";
3-
export * as io from "https://deno.land/x/std@0.110.0/io/mod.ts";
4-
export type { Deferred } from "https://deno.land/x/std@0.110.0/async/mod.ts";
2+
export { deferred, delay } from "https://deno.land/x/std@0.164.0/async/mod.ts";
3+
export * as streams from "https://deno.land/x/std@0.164.0/streams/mod.ts";
4+
export type { Deferred } from "https://deno.land/x/std@0.164.0/async/mod.ts";
55
export type { Disposable } from "https://deno.land/x/[email protected]/mod.ts";

deps_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export * from "https://deno.land/std@0.110.0/testing/asserts.ts";
2-
export { delay } from "https://deno.land/std@0.110.0/async/mod.ts";
1+
export * from "https://deno.land/std@0.164.0/testing/asserts.ts";
2+
export { delay } from "https://deno.land/std@0.164.0/async/mod.ts";
33
export { using } from "https://deno.land/x/[email protected]/mod.ts";

indexer_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ Deno.test("Indexer with 'max' works as expect", () => {
1818
});
1919

2020
Deno.test("Indexer with 'max' smaller than 2 throws error", () => {
21-
assertThrows(() => new Indexer(1), undefined, "must be greater than 1");
21+
assertThrows(() => new Indexer(1), Error, "must be greater than 1");
2222
});

response_waiter_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertEquals, assertThrowsAsync } from "./deps_test.ts";
1+
import { assertEquals, assertRejects } from "./deps_test.ts";
22
import { MessageId, ResponseMessage } from "./message.ts";
33
import { ResponseWaiter, TimeoutError } from "./response_waiter.ts";
44

@@ -30,7 +30,7 @@ Deno.test({
3030
fn: async () => {
3131
const msgid: MessageId = 0;
3232
const waiter = new ResponseWaiter();
33-
await assertThrowsAsync(async () => {
33+
await assertRejects(async () => {
3434
const promise = waiter.wait(msgid, 1);
3535
assertEquals(waiter.waiterCount, 1);
3636
await promise;

session.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
deferred,
55
Disposable,
66
encode,
7-
io,
7+
streams,
88
} from "./deps.ts";
99
import * as message from "./message.ts";
1010
import { Indexer } from "./indexer.ts";
@@ -83,7 +83,7 @@ export class Session implements Disposable {
8383
}
8484

8585
private async send(data: Uint8Array): Promise<void> {
86-
await io.writeAll(this.#writer, data);
86+
await streams.writeAll(this.#writer, data);
8787
}
8888

8989
private async dispatch(
@@ -134,7 +134,7 @@ export class Session implements Disposable {
134134
}
135135

136136
private async listen(): Promise<void> {
137-
const iter = decodeStream(io.iter(this.#reader));
137+
const iter = decodeStream(streams.iterateReader(this.#reader));
138138
try {
139139
while (!this.#closed) {
140140
const { done, value } = await Promise.race([

session_test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { io } from "./deps.ts";
2-
import { assertEquals, assertThrowsAsync, delay, using } from "./deps_test.ts";
1+
import { streams } from "./deps.ts";
2+
import { assertEquals, assertRejects, delay, using } from "./deps_test.ts";
33
import { Session, SessionClosedError } from "./session.ts";
44

55
class Reader implements Deno.Reader, Deno.Closer {
@@ -67,9 +67,9 @@ Deno.test("Make sure that Reader/Writer for tests works properly", async () => {
6767
const r = new Reader(q);
6868
const w = new Writer(q);
6969
const d = (new TextEncoder()).encode(buildMassiveData());
70-
await io.writeAll(w, d);
70+
await streams.writeAll(w, d);
7171
r.close();
72-
assertEquals(await io.readAll(r), d);
72+
assertEquals(await streams.readAll(r), d);
7373
});
7474

7575
Deno.test("Local can call Remote method", async () => {
@@ -219,7 +219,7 @@ Deno.test({
219219
const writer = new Writer(buffer);
220220
const session = new Session(reader, writer);
221221
session.close();
222-
await assertThrowsAsync(async () => {
222+
await assertRejects(async () => {
223223
await session.call("say");
224224
}, SessionClosedError);
225225
reader.close();
@@ -237,7 +237,7 @@ Deno.test({
237237
const writer = new Writer(buffer);
238238
const session = new Session(reader, writer);
239239
session.close();
240-
await assertThrowsAsync(async () => {
240+
await assertRejects(async () => {
241241
await session.notify("say");
242242
}, SessionClosedError);
243243
reader.close();
@@ -268,7 +268,7 @@ Deno.test({
268268
assertEquals(await local.call("say"), "Hello");
269269
});
270270
// Session is closed by `dispose`
271-
await assertThrowsAsync(async () => {
271+
await assertRejects(async () => {
272272
await local.call("say");
273273
}, SessionClosedError);
274274
// Close
@@ -298,7 +298,7 @@ Deno.test({
298298
return Promise.reject(new Error("Panic!"));
299299
},
300300
});
301-
await assertThrowsAsync(
301+
await assertRejects(
302302
async () => {
303303
await local.call("say");
304304
},
@@ -332,7 +332,7 @@ Deno.test({
332332
return Promise.reject("Panic!");
333333
},
334334
});
335-
await assertThrowsAsync(
335+
await assertRejects(
336336
async () => {
337337
await local.call("say");
338338
},
@@ -366,7 +366,7 @@ Deno.test({
366366
return Promise.reject(null);
367367
},
368368
});
369-
await assertThrowsAsync(
369+
await assertRejects(
370370
async () => {
371371
await local.call("say");
372372
},

0 commit comments

Comments
 (0)