Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
run: tar -xzf cldn-ip-0.0.0-dev.tgz --strip-components=1 -C . --overwrite

- name: Test
run: npm run test
run: npm run test:coverage

test-deno:
name: Test on Deno
Expand All @@ -98,13 +98,32 @@ jobs:
run: deno fmt --check

- name: Test
run: deno task test
run: deno task test:coverage

test-bun:
name: Test on Bun
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: bun install

- name: Run tests
run: bun run test

publish:
name: Publish
needs:
- test
- test-deno
- test-bun
if: github.event_name == 'release'
runs-on: ubuntu-latest
permissions:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 11 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,22 @@ arithmetic on IP addresses and subnets.

## Usage

### Node.js
### Installation

Install from NPM:
Install the package using your preferred environment:

```sh
# Node.js
npm install @cldn/ip
```

Import and use:

```ts
import { IPv4, IPv6, Subnet } from "@cldn/ip";
```

### Deno

Add from JSR:

```sh
# Deno
deno add jsr:@cldn/ip

# Bun
bun install @cldn/ip
```

Import and use:
### Import

```ts
import { IPv4, IPv6, Subnet } from "@cldn/ip";
Expand All @@ -46,10 +39,10 @@ import { IPv4, IPv6, Subnet } from "@cldn/ip";
### Browsers

For browser usage, it is recommended to use a bundler like
[Vite](https://vitejs.dev/), or [Webpack](https://webpack.js.org/). If you are
using a bundler, follow the same usage as for Node.js.
[Vite](https://vitejs.dev/) or [Webpack](https://webpack.js.org/). If using a
bundler, import as above.

Alternatively, you can import the library as a
Alternatively, load as a
[JavaScript module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)
from [ESM>CDN](https://esm.sh/):

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
],
"scripts": {
"build": "tsc",
"test": "vitest run --coverage",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"docs:gen": "typedoc && rm -rf docs/api && mv api docs/api",
"predocs:dev": "npm run docs:gen",
"docs:dev": "vitepress dev docs",
Expand Down
Loading