Skip to content

Commit

Permalink
JSR
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Mar 26, 2024
1 parent ddd18c3 commit b143fc4
Show file tree
Hide file tree
Showing 20 changed files with 110 additions and 116 deletions.
54 changes: 21 additions & 33 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
with:
files: .cov.lcov
env_vars: OS
- run: deno publish --dry-run

lint:
runs-on: ubuntu-22.04
Expand All @@ -50,6 +51,9 @@ jobs:
release:
if: github.event_name == 'push'
needs: [test, lint]
permissions:
contents: read
id-token: write
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
Expand All @@ -58,6 +62,22 @@ jobs:
deno-version: v1.x
- id: determine-version
run: deno run -A scripts/determine-version.ts
- if: github.ref_type == 'tag'
run: |
set -ex
[[ "$(jq -r .version deno.json)" = "$VERSION" ]]
env:
VERSION: ${{ steps.determine-version.outputs.version }}
- if: github.ref_type == 'branch'
run: |
set -ex
jq \
--arg version "$VERSION" \
'.version = $version' \
deno.json > deno.json.tmp
mv deno.json.tmp deno.json
env:
VERSION: ${{ steps.determine-version.outputs.version }}
- if: github.ref_type == 'tag'
run: '[[ "$VERSION" = "$GITHUB_REF_NAME" ]]'
env:
Expand All @@ -70,39 +90,7 @@ jobs:
popd
env:
VERSION: ${{ steps.determine-version.outputs.version }}
- run: deno install -Af --unstable https://x.nest.land/eggs@0.3.10/eggs.ts
- run: "eggs link '${{ secrets.NEST_API_KEY }}'"
- if: github.ref_type == 'tag'
uses: mikefarah/yq@master
with:
cmd: >-
yq -i
' strenv(GITHUB_REF_NAME) as $version
| .version = $version
| .unstable = false'
egg.yaml
- if: github.ref_type != 'tag'
uses: mikefarah/yq@master
with:
cmd: >-
yq -i
' strenv(VERSION) as $version
| .version = $version
| .unstable = true'
egg.yaml
env:
VERSION: ${{ steps.determine-version.outputs.version }}
- run: |
# Try up to 3 times as `eggs publish` frequently fails due to unknown
# reason (I guess it's a bug on the server side):
for _ in 1 2 3; do
eggs publish --debug --yes --no-check || continue
done
- if: failure()
uses: actions/upload-artifact@v3
with:
name: eggs-debug.log
path: ${{ github.workspace }}/eggs-debug.log
- run: deno publish --allow-dirty
- run: |
set -e
cd npm/
Expand Down
28 changes: 24 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,30 @@
"deno.enable": true,
"deno.lint": true,
"deno.unstable": false,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features",
"editor.formatOnSave": true
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.defaultFormatter": "denoland.vscode-deno"
"editor.defaultFormatter": "denoland.vscode-deno",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.sortImports": "always"
}
},
"files.insertFinalNewline": true
"cSpell.words": [
"aitertools",
"Codecov",
"concat",
"deno",
"hongminhee",
"Minhee"
]
}
12 changes: 8 additions & 4 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ Changelog
Version 0.6.0
-------------

To be released. Unreleased versions are available on [nest.land].
To be released.

- Now aitertools is [available on JSR].
- Now aitertools is no more available on [deno.land/x] and [nest.land].

[available on JSR]: https://jsr.io/@hongminhee/aitertools
[deno.land/x]: https://deno.land/x/aitertools
[nest.land]: https://nest.land/package/aitertools


Version 0.5.0
Expand Down Expand Up @@ -109,6 +116,3 @@ Version 0.1.0
-------------

Initial release. Released on May 23, 2022.


[nest.land]: https://nest.land/package/aitertools
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,34 @@
aitertools
==========

[![Latest version][Tag badge]][Deno module]
[![Published on JSR][JSR badge]][JSR]
[![Published on npm][npm badge]][npm]
[![Published on nest.land][nest.land badge]][nest.land]
[![LGPL 3.0][License badge]](./LICENSE)
[![Deno Doc (API references)][Deno Doc badge]][Deno Doc]
[![GitHub Actions][GitHub Actions status badge]][GitHub Actions]
[![Codecov][Codecov badge]][Codecov]

This library provides a [well-tested][Codecov] collection of small utility
functions dealing with [async iterables]. You can think of it as .NET LINQ or
Python aitertools for [Deno] & Node.js.

[Tag badge]: https://img.shields.io/github/v/tag/dahlia/aitertools
[Deno module]: https://deno.land/x/aitertools
[JSR badge]: https://jsr.io/badges/@hongminhee/aitertools
[JSR]: https://jsr.io/@hongminhee/aitertools
[npm badge]: https://img.shields.io/npm/v/aitertools
[npm]: https://www.npmjs.com/package/aitertools
[nest.land badge]: https://nest.land/badge.svg
[nest.land]: https://nest.land/package/aitertools
[License badge]: https://img.shields.io/github/license/dahlia/aitertools
[Deno Doc]: https://doc.deno.land/https://deno.land/x/aitertools/mod.ts
[Deno Doc badge]: https://img.shields.io/badge/api-deno%20doc-blue
[GitHub Actions]: https://github.com/dahlia/aitertools/actions/workflows/build.yaml
[GitHub Actions status badge]: https://github.com/dahlia/aitertools/actions/workflows/build.yaml/badge.svg
[Codecov badge]: https://codecov.io/gh/dahlia/aitertools/branch/main/graph/badge.svg?token=UBDX4Inrz6
[Codecov]: https://codecov.io/gh/dahlia/aitertools
[async iterables]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
[Deno]: https://deno.land/
[Deno]: https://deno.com/


Functions
---------

For the complete list of functions, see the [complete API reference][Deno Doc].
For the complete list of functions, see the [complete API reference][JSR].

- `concat(...sources)`: Concatenate multiple async iterables into one.
- `take(source, count)`: Take the first `count` items from the `source`.
Expand Down Expand Up @@ -81,8 +76,12 @@ Usage

In Deno:

~~~ console
$ deno add @hongminhee/aitertools
~~~

~~~ typescript
import * as aitertools from "https://deno.land/x/aitertools/mod.ts";
import * as aitertools from "@hongminhee/aitertools";
~~~

In Node.js:
Expand All @@ -100,11 +99,10 @@ Changelog
---------

See *[CHANGES.md](CHANGES.md)* file. Note that unreleased versions are also
available on [nest.land] for Deno:
available on [JSR] for Deno:

~~~ typescript
import * as aitertools
from "https://x.nest.land/aitertools@0.4.0-dev.15+3f191d7/mod.ts";
deno add @hongminhee/aitertools@0.6.0-dev.35+3f191d7
~~~

… and on [npm] with `dev` tag for Node.js:
Expand Down
25 changes: 25 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@hongminhee/aitertools",
"version": "0.6.0",
"exports": {
".": "./mod.ts",
"./collections": "./src/collections.ts",
"./concat": "./src/concat.ts",
"./drop": "./src/drop.ts",
"./filter": "./src/filter.ts",
"./fold": "./src/fold.ts",
"./infinite": "./src/infinite.ts",
"./map": "./src/map.ts",
"./range": "./src/range.ts",
"./take": "./src/take.ts",
"./tee": "./src/tee.ts",
"./testing": "./src/testing.ts",
"./unique": "./src/unique.ts"
},
"imports": {
"@deno/dnt": "jsr:@deno/dnt@^0.41.0",
"@std/assert": "jsr:@std/assert@^0.220.1",
"fast-check": "npm:fast-check@3.14.0"
},
"lock": false
}
3 changes: 2 additions & 1 deletion dnt.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { build, emptyDir } from "https://deno.land/x/dnt@0.39.0/mod.ts";
import { build, emptyDir } from "@deno/dnt";

await emptyDir("./npm");

Expand Down Expand Up @@ -38,6 +38,7 @@ await build({
shims: {
deno: true,
},
importMap: "deno.json",
typeCheck: "both",
test: true,
declaration: "separate",
Expand Down
26 changes: 0 additions & 26 deletions egg.yaml

This file was deleted.

6 changes: 1 addition & 5 deletions scripts/determine-version.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
dirname,
fromFileUrl,
join,
} from "https://deno.land/std@0.207.0/path/mod.ts";
import { dirname, fromFileUrl, join } from "jsr:@std/path@^0.220.1";
import * as commonmark from "npm:commonmark";

const projectDir = dirname(dirname(fromFileUrl(import.meta.url)));
Expand Down
2 changes: 1 addition & 1 deletion src/testing.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from "https://deno.land/std@0.207.0/assert/mod.ts";
import { assertEquals } from "@std/assert";

/**
* Makes an assertion that the elements of the `actual` iterable are equal to
Expand Down
4 changes: 2 additions & 2 deletions tests/collections_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertEquals } from "https://deno.land/std@0.207.0/assert/mod.ts";
import * as fc from "npm:fast-check@3.14.0";
import { assertEquals } from "@std/assert";
import * as fc from "fast-check";
import { fromIterable, toArray, toMap, toSet } from "../src/collections.ts";
import { assertStreams } from "../src/testing.ts";
import { getAsyncIterable } from "./testing_test.ts";
Expand Down
2 changes: 1 addition & 1 deletion tests/concat_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as fc from "npm:fast-check@3.14.0";
import * as fc from "fast-check";
import { fromIterable } from "../src/collections.ts";
import { concat } from "../src/concat.ts";
import { assertStreams } from "../src/testing.ts";
Expand Down
7 changes: 2 additions & 5 deletions tests/drop_test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
assert,
assertRejects,
} from "https://deno.land/std@0.207.0/assert/mod.ts";
import * as fc from "npm:fast-check@3.14.0";
import { assert, assertRejects } from "@std/assert";
import * as fc from "fast-check";
import { fromIterable, toArray } from "../src/collections.ts";
import { drop, dropEnd, dropWhile } from "../src/drop.ts";
import { count } from "../src/infinite.ts";
Expand Down
5 changes: 1 addition & 4 deletions tests/fold_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
assertEquals,
assertRejects,
} from "https://deno.land/std@0.207.0/assert/mod.ts";
import { assertEquals, assertRejects } from "@std/assert";
import { reduce } from "../src/fold.ts";
import { getAsyncIterable } from "./testing_test.ts";

Expand Down
2 changes: 1 addition & 1 deletion tests/infinite_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertThrows } from "https://deno.land/std@0.207.0/assert/mod.ts";
import { assertThrows } from "@std/assert";
import { count, cycle, repeat } from "../src/infinite.ts";
import { assertStreams, assertStreamStartsWith } from "../src/testing.ts";

Expand Down
2 changes: 1 addition & 1 deletion tests/map_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertRejects } from "https://deno.land/std@0.207.0/assert/mod.ts";
import { assertRejects } from "@std/assert";
import { count, repeat } from "../src/infinite.ts";
import { map } from "../src/map.ts";
import { assertStreams, assertStreamStartsWith } from "../src/testing.ts";
Expand Down
6 changes: 3 additions & 3 deletions tests/range_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
assertMatch,
assertNotEquals,
assertThrows,
} from "https://deno.land/std@0.207.0/assert/mod.ts";
import * as fc from "npm:fast-check@3.14.0";
import { assertStreams } from "../src/testing.ts";
} from "@std/assert";
import * as fc from "fast-check";
import { Range, range } from "../src/range.ts";
import { assertStreams } from "../src/testing.ts";

function validNumber(): fc.Arbitrary<number> {
return fc.oneof(
Expand Down
7 changes: 2 additions & 5 deletions tests/take_test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
assert,
assertRejects,
} from "https://deno.land/std@0.207.0/assert/mod.ts";
import * as fc from "npm:fast-check@3.14.0";
import { assert, assertRejects } from "@std/assert";
import * as fc from "fast-check";
import { fromIterable, toArray } from "../src/collections.ts";
import { count } from "../src/infinite.ts";
import { range } from "../src/range.ts";
Expand Down
2 changes: 1 addition & 1 deletion tests/tee_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as fc from "npm:fast-check@3.14.0";
import * as fc from "fast-check";
import { fromIterable } from "../src/collections.ts";
import { tee } from "../src/tee.ts";
import { assertStreams, assertStreamStartsWith } from "../src/testing.ts";
Expand Down
5 changes: 1 addition & 4 deletions tests/testing_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
AssertionError,
assertRejects,
} from "https://deno.land/std@0.207.0/assert/mod.ts";
import { AssertionError, assertRejects } from "@std/assert";
import * as fc from "npm:fast-check@3.14.0";
import { fromIterable } from "../src/collections.ts";
import { assertStreams, assertStreamStartsWith } from "../src/testing.ts";
Expand Down
2 changes: 1 addition & 1 deletion tests/unique_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from "https://deno.land/std@0.207.0/assert/mod.ts";
import { assertEquals } from "@std/assert";
import { tee } from "../src/tee.ts";
import { assertStreams } from "../src/testing.ts";
import { groupBy, unique } from "../src/unique.ts";
Expand Down

0 comments on commit b143fc4

Please sign in to comment.