diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6c9f731..889e537 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -36,6 +36,7 @@ jobs: with: files: .cov.lcov env_vars: OS + - run: deno publish --dry-run lint: runs-on: ubuntu-22.04 @@ -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 @@ -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: @@ -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/ diff --git a/.vscode/settings.json b/.vscode/settings.json index 6d74ec0..d7a90a6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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" + ] } diff --git a/CHANGES.md b/CHANGES.md index b91c087..0e4a131 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 @@ -109,6 +116,3 @@ Version 0.1.0 ------------- Initial release. Released on May 23, 2022. - - -[nest.land]: https://nest.land/package/aitertools diff --git a/README.md b/README.md index 71ff56d..34581ec 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,9 @@ 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] @@ -15,27 +13,24 @@ 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`. @@ -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: @@ -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: diff --git a/deno.json b/deno.json new file mode 100644 index 0000000..38cb32f --- /dev/null +++ b/deno.json @@ -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 +} diff --git a/dnt.ts b/dnt.ts index b919b7a..1630044 100644 --- a/dnt.ts +++ b/dnt.ts @@ -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"); @@ -38,6 +38,7 @@ await build({ shims: { deno: true, }, + importMap: "deno.json", typeCheck: "both", test: true, declaration: "separate", diff --git a/egg.yaml b/egg.yaml deleted file mode 100644 index 786ae83..0000000 --- a/egg.yaml +++ /dev/null @@ -1,26 +0,0 @@ -$schema: https://x.nest.land/eggs@0.3.10/src/schema.json -name: aitertools -description: Well-tested utility functions dealing with async iterables -homepage: https://github.com/dahlia/aitertools -releaseType: null -unstable: false -unlisted: false -entry: ./mod.ts -files: -- ./*.md -- ./*.ts -- ./*.yaml -- ./*.yml -- ./.github/**/*.yaml -- ./.vscode/*.json -- ./hooks/* -- ./tests/*.ts -- ./LICENSE -ignore: -- ./.git/* -- ./.git/**/* -- ./egg.yml -checkFormat: true -checkTests: true -checkInstallation: false -check: true diff --git a/scripts/determine-version.ts b/scripts/determine-version.ts index 78581e2..9fe53b0 100644 --- a/scripts/determine-version.ts +++ b/scripts/determine-version.ts @@ -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))); diff --git a/src/testing.ts b/src/testing.ts index f8f161f..9c7fad3 100644 --- a/src/testing.ts +++ b/src/testing.ts @@ -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 diff --git a/tests/collections_test.ts b/tests/collections_test.ts index 0384282..6cd6b9d 100644 --- a/tests/collections_test.ts +++ b/tests/collections_test.ts @@ -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"; diff --git a/tests/concat_test.ts b/tests/concat_test.ts index a06b6fd..62ae46c 100644 --- a/tests/concat_test.ts +++ b/tests/concat_test.ts @@ -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"; diff --git a/tests/drop_test.ts b/tests/drop_test.ts index 70faedb..af02ac8 100644 --- a/tests/drop_test.ts +++ b/tests/drop_test.ts @@ -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"; diff --git a/tests/fold_test.ts b/tests/fold_test.ts index 9250af9..dbba70a 100644 --- a/tests/fold_test.ts +++ b/tests/fold_test.ts @@ -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"; diff --git a/tests/infinite_test.ts b/tests/infinite_test.ts index 4eaa4ce..9b44365 100644 --- a/tests/infinite_test.ts +++ b/tests/infinite_test.ts @@ -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"; diff --git a/tests/map_test.ts b/tests/map_test.ts index da8a4d3..f1270ec 100644 --- a/tests/map_test.ts +++ b/tests/map_test.ts @@ -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"; diff --git a/tests/range_test.ts b/tests/range_test.ts index 00749ed..58209b1 100644 --- a/tests/range_test.ts +++ b/tests/range_test.ts @@ -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 { return fc.oneof( diff --git a/tests/take_test.ts b/tests/take_test.ts index 3d78173..859e569 100644 --- a/tests/take_test.ts +++ b/tests/take_test.ts @@ -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"; diff --git a/tests/tee_test.ts b/tests/tee_test.ts index 5b2f91f..f30e165 100644 --- a/tests/tee_test.ts +++ b/tests/tee_test.ts @@ -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"; diff --git a/tests/testing_test.ts b/tests/testing_test.ts index d37fbe4..05644db 100644 --- a/tests/testing_test.ts +++ b/tests/testing_test.ts @@ -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"; diff --git a/tests/unique_test.ts b/tests/unique_test.ts index 7dd2726..2964090 100644 --- a/tests/unique_test.ts +++ b/tests/unique_test.ts @@ -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";