Skip to content

Commit d70f0c8

Browse files
authored
Merge pull request #4 from lambdalisue/support-jsr
Support jsr
2 parents ee4d709 + 5c2a489 commit d70f0c8

File tree

15 files changed

+62
-108
lines changed

15 files changed

+62
-108
lines changed

.github/workflows/jsr.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: jsr
2+
3+
env:
4+
DENO_VERSION: 1.x
5+
6+
on:
7+
push:
8+
tags:
9+
- "v*"
10+
11+
permissions:
12+
contents: read
13+
id-token: write
14+
15+
jobs:
16+
publish:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- uses: denoland/setup-deno@v1
23+
with:
24+
deno-version: ${{ env.DENO_VERSION }}
25+
- name: Publish
26+
run: |
27+
deno run -A jsr:@david/[email protected]

.github/workflows/test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ on:
1010
branches:
1111
- main
1212
pull_request:
13+
workflow_dispatch:
1314

1415
jobs:
1516
check:
1617
runs-on: ubuntu-latest
1718
steps:
18-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
1920
- uses: denoland/setup-deno@v1
2021
with:
2122
deno-version: ${{ env.DENO_VERSION }}
@@ -30,11 +31,14 @@ jobs:
3031
test:
3132
runs-on: ubuntu-latest
3233
steps:
33-
- uses: actions/checkout@v3
34+
- uses: actions/checkout@v4
3435
- uses: denoland/setup-deno@v1
3536
with:
3637
deno-version: ${{ env.DENO_VERSION }}
3738
- name: Test
3839
run: |
3940
deno task test
4041
timeout-minutes: 5
42+
- name: JSR publish (dry-run)
43+
run: |
44+
deno publish --dry-run

.github/workflows/udd.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# streamtools
22

3-
[![deno land](http://img.shields.io/badge/available%20on-deno.land/x-lightgrey.svg?logo=deno)](https://deno.land/x/streamtools)
3+
[![jsr](https://img.shields.io/jsr/v/%40lambdalisue/streamtools?logo=javascript&logoColor=white)](https://jsr.io/@lambdalisue/streamtools)
4+
[![denoland](https://img.shields.io/github/v/release/lambdalisue/deno-streamtools?logo=deno&label=denoland)](https://github.com/lambdalisue/deno-streamtools/releases)
45
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/streamtools/mod.ts)
56
[![Test](https://github.com/lambdalisue/deno-streamtools/workflows/Test/badge.svg)](https://github.com/lambdalisue/deno-streamtools/actions?query=workflow%3ATest)
67

7-
This is a [Deno][deno] module that provides utilities for handling Streams API.
8-
9-
[deno]: https://deno.land/
8+
This is a TypeScript module that provides utilities for handling Streams API.
109

1110
## Usage
1211

@@ -138,7 +137,7 @@ console.log(results); // [1, 2, 3]
138137
and concatenates them into a single `Uint8Array`.
139138

140139
```ts
141-
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
140+
import { assertEquals } from "jsr:@std/assert";
142141
import { readAll } from "./read_all.ts";
143142

144143
const encoder = new TextEncoder();
@@ -157,7 +156,7 @@ assertEquals(result, encoder.encode("HelloWorld"));
157156
units.
158157

159158
```ts
160-
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
159+
import { assertEquals } from "jsr:@std/assert";
161160
import { writeAll } from "./write_all.ts";
162161

163162
const encoder = new TextEncoder();

channel_bench.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { channel as channelV3 } from "https://deno.land/x/[email protected]/channel.ts#=";
21
import { channel } from "./channel.ts";
32

43
Deno.bench("channel", { group: "channel", baseline: true }, async () => {
@@ -20,23 +19,3 @@ Deno.bench("channel", { group: "channel", baseline: true }, async () => {
2019
};
2120
await Promise.all([producer(), consumer()]);
2221
});
23-
24-
Deno.bench("channelV3", { group: "channel" }, async () => {
25-
const { reader, writer } = channelV3<number>();
26-
27-
const producer = async () => {
28-
const w = writer.getWriter();
29-
for (let i = 0; i < 100000; i++) {
30-
await w.ready;
31-
await w.write(i);
32-
}
33-
w.releaseLock();
34-
await writer.close();
35-
};
36-
const consumer = async () => {
37-
for await (const _ of reader) {
38-
// Do NOTHING
39-
}
40-
};
41-
await Promise.all([producer(), consumer()]);
42-
});

channel_test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
import {
2-
assertEquals,
3-
assertRejects,
4-
} from "https://deno.land/[email protected]/testing/asserts.ts";
5-
import {
6-
deadline,
7-
DeadlineError,
8-
} from "https://deno.land/[email protected]/async/mod.ts";
1+
import { assertEquals, assertRejects } from "@std/assert";
2+
import { deadline, DeadlineError } from "@std/async";
93
import { provide } from "./provide.ts";
104
import { pop } from "./pop.ts";
115
import { push } from "./push.ts";

collect_test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
import {
2-
assertEquals,
3-
assertRejects,
4-
} from "https://deno.land/[email protected]/testing/asserts.ts";
5-
import {
6-
deadline,
7-
DeadlineError,
8-
} from "https://deno.land/[email protected]/async/deadline.ts";
1+
import { assertEquals, assertRejects } from "@std/assert";
2+
import { deadline, DeadlineError } from "@std/async";
93
import { collect } from "./collect.ts";
104

115
Deno.test("collect returns an empty array for an empty stream", async () => {

deno.jsonc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
{
2+
"name": "@lambdalisue/streamtools",
3+
"version": "0.0.0",
4+
"exports": "./mod.ts",
25
"tasks": {
3-
"test": "deno test --no-lock --unstable -A --parallel --doc",
4-
"check": "deno check --no-lock --unstable $(find . -name '*.ts')",
5-
"upgrade": "deno run --no-lock -A https://deno.land/x/udd/main.ts $(find . -name '*.ts')"
6+
"test": "deno test -A --parallel --doc --shuffle",
7+
"check": "deno check **/*.ts"
8+
},
9+
"imports": {
10+
"@std/assert": "jsr:@std/assert@^0.221.0",
11+
"@std/async": "jsr:@std/async@^0.221.0",
12+
"@std/bytes": "jsr:@std/bytes@^0.221.0"
613
}
714
}

pipe_through_from_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
1+
import { assertEquals } from "@std/assert";
22
import { collect } from "./collect.ts";
33
import { channel } from "./channel.ts";
44
import { pipeThroughFrom } from "./pipe_through_from.ts";

pop_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
1+
import { assertEquals } from "@std/assert";
22
import { pop } from "./pop.ts";
33

44
Deno.test("pop", async (t) => {

0 commit comments

Comments
 (0)