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
6 changes: 1 addition & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
gleam-version: '1.13.0'
- uses: actions/setup-node@v4
with:
node-version: '22'
node-version: lts/*

- name: check version
run: |
Expand All @@ -31,10 +31,6 @@ jobs:

- run: gleam deps download
- run: gleam format --check
- run: gleam run -m histogram_builder -t erlang
- run: gleam test -t erlang
- run: gleam run -m histogram_builder -t javascript
- run: gleam test -t javascript

- run: gleam publish -y
env:
Expand Down
24 changes: 23 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,32 @@ jobs:
gleam-version: '1.13.0'
- uses: actions/setup-node@v4
with:
node-version: '22'
node-version: lts/*
- run: gleam deps download
- run: gleam format --check
- run: gleam run -m histogram_builder -t erlang
- run: gleam test -t erlang
- run: gleam run -m histogram_builder -t javascript
- run: gleam test -t javascript

playwright-test:
timeout-minutes: 60
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./web_test
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: '28'
rebar3-version: '3'
gleam-version: '1.13.0'
- uses: actions/setup-node@v4
with:
node-version: lts/*
- run: gleam deps download
- run: npm ci
- run: gleam run -m lustre/dev build
- run: npx playwright install --with-deps
- run: npx playwright test
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@
This is a port of [paralleldrive/cuid2@v3.0.0](https://github.com/paralleldrive/cuid2/tree/v3.0.0) in Gleam that works on all target.
For more detailed information about Cuid2, please refer to the [original documentation](https://github.com/paralleldrive/cuid2/blob/v3.0.0/README.md).

On `javascript` target this package uses [paulmillr/noble-hashes@2.0.1](https://github.com/paulmillr/noble-hashes/tree/2.0.1) for browser compatibility.
### Notes on JavaScript target

This package uses either [noble-hashes](https://github.com/paulmillr/noble-hashes) or [node:crypto](https://nodejs.org/api/crypto.html#cryptohashalgorithm-data-options) for hashing.

On browser `noble-hashes` is **required**.
You can install it by using `npm install @noble/hashes`.

On server this package will try to use `noble-hashes` first, then fallback to `node:crypto` if `noble-hashes` is not installed.

## Cuid2

Expand Down Expand Up @@ -41,6 +48,12 @@ Add to your Gleam project:
gleam add glecuid
```

Install [noble-hashes](https://github.com/paulmillr/noble-hashes) if your project needs to run on browser (see [note](#notes-on-javascript-target)):

```
npm install @noble/hashes
```

Generate some ids:

```gleam
Expand Down
2 changes: 1 addition & 1 deletion gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "glecuid"
version = "1.0.4"
version = "2.0.0"

licences = ["MIT"]
description = "A Gleam implementation of CUID2, the secure, collision-resistant ids optimized for horizontal scaling and performance."
Expand Down
44 changes: 44 additions & 0 deletions package-lock.json

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

9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "module",
"dependencies": {
"@noble/hashes": "^2.0.1"
},
"devDependencies": {
"@types/node": "^24.10.1"
}
}
21 changes: 0 additions & 21 deletions src/@noble/hashes/LICENSE

This file was deleted.

91 changes: 0 additions & 91 deletions src/@noble/hashes/_u64.ts

This file was deleted.

Loading