Skip to content

Commit

Permalink
Publish to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Nov 23, 2023
1 parent b6797c1 commit 046ea30
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ jobs:
run: '[[ "$VERSION" = "$GITHUB_REF_NAME" ]]'
env:
VERSION: ${{ steps.determine-version.outputs.version }}
- run: |
set -e
deno run -A dnt.ts "$VERSION"
pushd npm/
npm pack --dry-run
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'
Expand Down Expand Up @@ -95,3 +103,13 @@ jobs:
with:
name: eggs-debug.log
path: ${{ github.workspace }}/eggs-debug.log
- run: |
set -e
cd npm/
if [[ "$GITHUB_REF_TYPE" = "tag" ]]; then
npm publish
else
npm publish --tag dev
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.cov/
docs/
npm/
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ Version 0.5.0

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

- Now aitertools is [available on npm].
- Now every submodule is inside *src/* directory. This is a breaking change
for users whom import submodules directly. For users whom import from
*mod.ts* module, this is not a breaking change.
- Added *src/range.ts* module.
- Added `range()` function.
- Added `Range` class.

[available on npm]: https://www.npmjs.com/package/aitertools


Version 0.4.0
-------------
Expand Down
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ aitertools
==========

[![Latest version][Tag badge]][Deno module]
[![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]
Expand All @@ -12,10 +13,12 @@ aitertools

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].
Python aitertools for [Deno] & Node.js.

[Tag badge]: https://img.shields.io/github/v/tag/dahlia/aitertools
[Deno module]: https://deno.land/x/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
Expand Down Expand Up @@ -80,15 +83,30 @@ In Deno:
import * as aitertools from "https://deno.land/x/aitertools/mod.ts";
~~~

In Node.js:

~~~ console
$ npm add aitertools
~~~

~~~ typescript
import * as aitertools from "aitertools";
~~~


Changelog
---------

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

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

… and on [npm] with `dev` tag for Node.js:

~~~ console
$ npm add aitertools@dev
~~~
51 changes: 51 additions & 0 deletions dnt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { build, emptyDir } from "https://deno.land/x/dnt@0.39.0/mod.ts";

await emptyDir("./npm");

const version = Deno.args[0];

await build({
entryPoints: ["./mod.ts"],
outDir: "./npm",
package: {
// package.json properties
name: "aitertools",
version,
description: "Well-tested utility functions dealing with async iterables",
keywords: [
"iterable",
"iterator",
"async",
"stream",
"async-iterable",
"async-iterator",
],
license: "LGPL-3.0-or-later",
author: {
name: "Hong Minhee",
email: "hong@minhee.org",
url: "https://hongminhee.org/",
},
homepage: "https://github.com/dahlia/aitertools",
repository: {
type: "git",
url: "git+https://github.com/dahlia/aitertools.git",
},
bugs: {
url: "https://github.com/dahlia/aitertools/issues",
},
},
shims: {
deno: true,
},
typeCheck: "both",
test: true,
declaration: "separate",
esModule: true,
rootTestDir: "./tests",
});

// post build steps
Deno.copyFileSync("LICENSE", "npm/LICENSE");
Deno.copyFileSync("README.md", "npm/README.md");
Deno.copyFileSync("CHANGES.md", "npm/CHANGES.md");

0 comments on commit 046ea30

Please sign in to comment.