From 9c25882a1b4a7c45d0175c6a1d631efabd861eb4 Mon Sep 17 00:00:00 2001 From: Alisue Date: Sat, 6 Apr 2024 17:35:02 +0900 Subject: [PATCH 1/3] Remove benchmark of v3 --- channel_bench.ts | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/channel_bench.ts b/channel_bench.ts index f188e28..56ed78b 100644 --- a/channel_bench.ts +++ b/channel_bench.ts @@ -1,4 +1,3 @@ -import { channel as channelV3 } from "https://deno.land/x/streamtools@v0.3.0/channel.ts#="; import { channel } from "./channel.ts"; Deno.bench("channel", { group: "channel", baseline: true }, async () => { @@ -20,23 +19,3 @@ Deno.bench("channel", { group: "channel", baseline: true }, async () => { }; await Promise.all([producer(), consumer()]); }); - -Deno.bench("channelV3", { group: "channel" }, async () => { - const { reader, writer } = channelV3(); - - const producer = async () => { - const w = writer.getWriter(); - for (let i = 0; i < 100000; i++) { - await w.ready; - await w.write(i); - } - w.releaseLock(); - await writer.close(); - }; - const consumer = async () => { - for await (const _ of reader) { - // Do NOTHING - } - }; - await Promise.all([producer(), consumer()]); -}); From 298191640d55269be88c788951432cd1993ea62b Mon Sep 17 00:00:00 2001 From: Alisue Date: Sat, 6 Apr 2024 17:40:47 +0900 Subject: [PATCH 2/3] Avoid HTTP imports --- channel_test.ts | 10 ++-------- collect_test.ts | 10 ++-------- deno.jsonc | 10 +++++++--- pipe_through_from_test.ts | 2 +- pop_test.ts | 2 +- provide_test.ts | 2 +- push_test.ts | 2 +- read_all.ts | 4 ++-- read_all_test.ts | 2 +- write_all_test.ts | 6 +++--- 10 files changed, 21 insertions(+), 29 deletions(-) diff --git a/channel_test.ts b/channel_test.ts index 07f0f0a..8531bce 100644 --- a/channel_test.ts +++ b/channel_test.ts @@ -1,11 +1,5 @@ -import { - assertEquals, - assertRejects, -} from "https://deno.land/std@0.187.0/testing/asserts.ts"; -import { - deadline, - DeadlineError, -} from "https://deno.land/std@0.187.0/async/mod.ts"; +import { assertEquals, assertRejects } from "@std/assert"; +import { deadline, DeadlineError } from "@std/async"; import { provide } from "./provide.ts"; import { pop } from "./pop.ts"; import { push } from "./push.ts"; diff --git a/collect_test.ts b/collect_test.ts index 63ca99c..63fb2d2 100644 --- a/collect_test.ts +++ b/collect_test.ts @@ -1,11 +1,5 @@ -import { - assertEquals, - assertRejects, -} from "https://deno.land/std@0.187.0/testing/asserts.ts"; -import { - deadline, - DeadlineError, -} from "https://deno.land/std@0.187.0/async/deadline.ts"; +import { assertEquals, assertRejects } from "@std/assert"; +import { deadline, DeadlineError } from "@std/async"; import { collect } from "./collect.ts"; Deno.test("collect returns an empty array for an empty stream", async () => { diff --git a/deno.jsonc b/deno.jsonc index 7e3b493..65ff2d2 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,7 +1,11 @@ { "tasks": { - "test": "deno test --no-lock --unstable -A --parallel --doc", - "check": "deno check --no-lock --unstable $(find . -name '*.ts')", - "upgrade": "deno run --no-lock -A https://deno.land/x/udd/main.ts $(find . -name '*.ts')" + "test": "deno test -A --parallel --doc --shuffle", + "check": "deno check **/*.ts" + }, + "imports": { + "@std/assert": "jsr:@std/assert@^0.221.0", + "@std/async": "jsr:@std/async@^0.221.0", + "@std/bytes": "jsr:@std/bytes@^0.221.0" } } diff --git a/pipe_through_from_test.ts b/pipe_through_from_test.ts index d3efa83..7e74e9f 100644 --- a/pipe_through_from_test.ts +++ b/pipe_through_from_test.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "https://deno.land/std@0.187.0/testing/asserts.ts"; +import { assertEquals } from "@std/assert"; import { collect } from "./collect.ts"; import { channel } from "./channel.ts"; import { pipeThroughFrom } from "./pipe_through_from.ts"; diff --git a/pop_test.ts b/pop_test.ts index a1b1a48..631d7f8 100644 --- a/pop_test.ts +++ b/pop_test.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "https://deno.land/std@0.187.0/testing/asserts.ts"; +import { assertEquals } from "@std/assert"; import { pop } from "./pop.ts"; Deno.test("pop", async (t) => { diff --git a/provide_test.ts b/provide_test.ts index 57d6c79..57d0725 100644 --- a/provide_test.ts +++ b/provide_test.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "https://deno.land/std@0.187.0/testing/asserts.ts"; +import { assertEquals } from "@std/assert"; import { provide } from "./provide.ts"; Deno.test("provide writes all values to stream", async () => { diff --git a/push_test.ts b/push_test.ts index a94ea03..e5bbe1b 100644 --- a/push_test.ts +++ b/push_test.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "https://deno.land/std@0.187.0/testing/asserts.ts"; +import { assertEquals } from "@std/assert"; import { push } from "./push.ts"; Deno.test("push", async (t) => { diff --git a/read_all.ts b/read_all.ts index a38b3b1..091aa8e 100644 --- a/read_all.ts +++ b/read_all.ts @@ -1,4 +1,4 @@ -import { concat } from "https://deno.land/std@0.187.0/bytes/mod.ts"; +import { concat } from "@std/bytes"; import { collect } from "./collect.ts"; /** @@ -33,5 +33,5 @@ export async function readAll( options: PipeOptions = {}, ): Promise { const chunks = await collect(stream, options); - return concat(...chunks); + return concat(chunks); } diff --git a/read_all_test.ts b/read_all_test.ts index 063725d..b438568 100644 --- a/read_all_test.ts +++ b/read_all_test.ts @@ -1,4 +1,4 @@ -import { assertEquals } from "https://deno.land/std@0.187.0/testing/asserts.ts"; +import { assertEquals } from "@std/assert"; import { readAll } from "./read_all.ts"; Deno.test("readAll", async () => { diff --git a/write_all_test.ts b/write_all_test.ts index 9f34da2..2fcdfad 100644 --- a/write_all_test.ts +++ b/write_all_test.ts @@ -1,5 +1,5 @@ -import { assertEquals } from "https://deno.land/std@0.187.0/testing/asserts.ts"; -import { concat } from "https://deno.land/std@0.187.0/bytes/mod.ts"; +import { assertEquals } from "@std/assert"; +import { concat } from "@std/bytes"; import { writeAll } from "./write_all.ts"; Deno.test("writeAll", async (t) => { @@ -14,7 +14,7 @@ Deno.test("writeAll", async (t) => { }, }); await writeAll(stream, encoder.encode("HelloWorld"), { chunkSize: 3 }); - assertEquals(concat(...chunks), encoder.encode("HelloWorld")); + assertEquals(concat(chunks), encoder.encode("HelloWorld")); assertEquals(chunks, [ encoder.encode("Hel"), encoder.encode("loW"), From 5c2a489173f0dae3c62b55ceada6c878ec4f52db Mon Sep 17 00:00:00 2001 From: Alisue Date: Sat, 6 Apr 2024 17:44:07 +0900 Subject: [PATCH 3/3] Support JSR --- .github/workflows/jsr.yml | 27 ++++++++++++++++++++ .github/workflows/test.yml | 8 ++++-- .github/workflows/udd.yml | 50 -------------------------------------- README.md | 11 ++++----- deno.jsonc | 3 +++ 5 files changed, 41 insertions(+), 58 deletions(-) create mode 100644 .github/workflows/jsr.yml delete mode 100644 .github/workflows/udd.yml diff --git a/.github/workflows/jsr.yml b/.github/workflows/jsr.yml new file mode 100644 index 0000000..2de3f3a --- /dev/null +++ b/.github/workflows/jsr.yml @@ -0,0 +1,27 @@ +name: jsr + +env: + DENO_VERSION: 1.x + +on: + push: + tags: + - "v*" + +permissions: + contents: read + id-token: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: denoland/setup-deno@v1 + with: + deno-version: ${{ env.DENO_VERSION }} + - name: Publish + run: | + deno run -A jsr:@david/publish-on-tag@0.1.3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60717c1..045fbcb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,12 +10,13 @@ on: branches: - main pull_request: + workflow_dispatch: jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: denoland/setup-deno@v1 with: deno-version: ${{ env.DENO_VERSION }} @@ -30,7 +31,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: denoland/setup-deno@v1 with: deno-version: ${{ env.DENO_VERSION }} @@ -38,3 +39,6 @@ jobs: run: | deno task test timeout-minutes: 5 + - name: JSR publish (dry-run) + run: | + deno publish --dry-run diff --git a/.github/workflows/udd.yml b/.github/workflows/udd.yml deleted file mode 100644 index 149b884..0000000 --- a/.github/workflows/udd.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Update - -on: - schedule: - - cron: "0 0 * * *" - workflow_dispatch: - -jobs: - udd: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: denoland/setup-deno@v1 - with: - deno-version: "1.x" - - name: Update dependencies - run: | - deno task upgrade > ../output.txt - env: - NO_COLOR: 1 - - name: Read ../output.txt - id: log - uses: juliangruber/read-file-action@v1 - with: - path: ../output.txt - - name: Commit changes - run: | - git config user.name '${{ github.actor }}' - git config user.email '${{ github.actor }}@users.noreply.github.com' - git commit -a -F- <