mirror of
https://github.com/logos-messaging/js-rln.git
synced 2026-01-05 15:13:12 +00:00
Merge pull request #20 from waku-org/ci
This commit is contained in:
commit
4b656ce0f9
70
.github/workflows/ci.yml
vendored
Normal file
70
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
- "staging"
|
||||
- "trying"
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
NODE_JS: "16"
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ env.NODE_JS }}
|
||||
- uses: bahmutov/npm-install@v1
|
||||
- run: npm run test:lint
|
||||
- run: npm run test:prettier
|
||||
- run: npm run test:spelling
|
||||
- run: npm run test:tsc
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ env.NODE_JS }}
|
||||
- uses: bahmutov/npm-install@v1
|
||||
- run: npm run build
|
||||
|
||||
browser:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ env.NODE_JS }}
|
||||
- uses: bahmutov/npm-install@v1
|
||||
- run: npm run test:browser
|
||||
|
||||
release_next:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
needs: [check, build, browser]
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ env.NODE_JS }}
|
||||
- uses: bahmutov/npm-install@v1
|
||||
|
||||
- name: Append git hash to version
|
||||
shell: bash
|
||||
run: |
|
||||
CURR_VERSION=$(cat package.json | jq .version | tr -d '"')
|
||||
GIT_HASH=$(git rev-parse --short HEAD)
|
||||
cat package.json| jq --arg version "$CURR_VERSION-$GIT_HASH" '.version |= $version' > _package.json
|
||||
mv -f _package.json package.json
|
||||
|
||||
- name: Authenticate with registry
|
||||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ./.npmrc
|
||||
|
||||
- run: npm publish --tag next --access public
|
||||
6
example/package-lock.json
generated
6
example/package-lock.json
generated
@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "rln-wasm-example",
|
||||
"name": "@waku/rln-example",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "rln-wasm-example",
|
||||
"name": "@waku/rln-example",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@waku/rln": "file:../"
|
||||
@ -54,6 +54,7 @@
|
||||
"husky": "^7.0.4",
|
||||
"ignore-loader": "^0.1.2",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"js-waku": "^0.29.0-7714812",
|
||||
"jsdom": "^19.0.0",
|
||||
"jsdom-global": "^3.0.2",
|
||||
"karma": "^6.3.12",
|
||||
@ -3971,6 +3972,7 @@
|
||||
"husky": "^7.0.4",
|
||||
"ignore-loader": "^0.1.2",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"js-waku": "^0.29.0-7714812",
|
||||
"jsdom": "^19.0.0",
|
||||
"jsdom-global": "^3.0.2",
|
||||
"karma": "^6.3.12",
|
||||
|
||||
20
package-lock.json
generated
20
package-lock.json
generated
@ -10421,6 +10421,16 @@
|
||||
"through": "^2.3.8"
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "5.10.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.10.0.tgz",
|
||||
"integrity": "sha512-c8HsD3IbwmjjbLvoZuRI26TZic+TSEe8FPMLLOkN1AfYRhdjnKBU6yL+IwcSCbdZiX4e5t0lfMDLDCqj4Sq70g==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12.18"
|
||||
}
|
||||
},
|
||||
"node_modules/unique-string": {
|
||||
"version": "2.0.0",
|
||||
"dev": true,
|
||||
@ -16505,7 +16515,8 @@
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/native-fetch/-/native-fetch-4.0.2.tgz",
|
||||
"integrity": "sha512-4QcVlKFtv2EYVS5MBgsGX5+NWKtbDbIECdUXDBGDMAZXq3Jkv9zf+y8iS7Ub8fEdga3GpYeazp9gauNqXHJOCg==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"natural-compare": {
|
||||
"version": "1.4.0",
|
||||
@ -18252,6 +18263,13 @@
|
||||
"through": "^2.3.8"
|
||||
}
|
||||
},
|
||||
"undici": {
|
||||
"version": "5.10.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.10.0.tgz",
|
||||
"integrity": "sha512-c8HsD3IbwmjjbLvoZuRI26TZic+TSEe8FPMLLOkN1AfYRhdjnKBU6yL+IwcSCbdZiX4e5t0lfMDLDCqj4Sq70g==",
|
||||
"dev": true,
|
||||
"peer": true
|
||||
},
|
||||
"unique-string": {
|
||||
"version": "2.0.0",
|
||||
"dev": true,
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
"test:lint": "eslint src --ext .ts",
|
||||
"test:prettier": "prettier \"src/**/*.ts\" \"./*.json\" \"*.*js\" \".github/**/*.yml\" --list-different",
|
||||
"test:spelling": "cspell \"{*.md,.github/*.md,src/**/*.ts}\"",
|
||||
"test:tsc": "tsc",
|
||||
"test:tsc": "tsc -p tsconfig.dev.json",
|
||||
"test:browser": "karma start karma.conf.cjs",
|
||||
"watch:build": "tsc -p tsconfig.json -w",
|
||||
"watch:test": "mocha --watch",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import debug from "debug";
|
||||
import {proto_message, utils} from "js-waku";
|
||||
import { proto_message, utils } from "js-waku";
|
||||
import {
|
||||
Decoder,
|
||||
Encoder,
|
||||
@ -76,6 +76,6 @@ export class RLNDecoder implements Decoder<Message> {
|
||||
}
|
||||
|
||||
function toRLNSignal(msg: Message): Uint8Array {
|
||||
const contentTopicBytes = utils.utf8ToBytes(msg.contentTopic ?? "")
|
||||
const contentTopicBytes = utils.utf8ToBytes(msg.contentTopic ?? "");
|
||||
return new Uint8Array([...(msg.payload ?? []), ...contentTopicBytes]);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user