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
10 changes: 6 additions & 4 deletions .github/workflows/npm-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ jobs:
run: rustup update nightly
- name: set nightly Rust default
run: rustup default nightly
- name: Install wasm-pack
run: sh -c "curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh"
- name: add wasm32-unknown-unknown target
run: rustup target add wasm32-unknown-unknown
- name: install wasm-bindgen-cli
run: cargo install wasm-bindgen-cli
- name: build and publish the package
run: |
set -e
echo //registry.npmjs.com/:_authToken=${{ secrets.NPM_CD_TOKEN }} > ~/.npmrc
echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_CD_TOKEN }} > ~/.npmrc
cd wasm_web
wasm-pack build
make build
cd pkg
npm pack
npm publish
8 changes: 5 additions & 3 deletions .github/workflows/npm-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
run: rustup update nightly
- name: set nightly Rust default
run: rustup default nightly
- name: Install wasm-pack
run: sh -c "curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh"
- name: add wasm32-unknown-unknown target
run: rustup target add wasm32-unknown-unknown
- name: install wasm-bindgen-cli
run: cargo install wasm-bindgen-cli
- name: build package
run: cd wasm_web && wasm-pack build && wasm-pack pack
run: cd wasm_web && make clean && make build
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion tiny_prng/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tiny_prng"
version = "0.2.4"
version = "0.2.5"
edition = "2024"
license = "MIT OR Apache-2.0"
description = "Tiny pseudo number generator set (MT, Xorshift and PCG)"
Expand Down
28 changes: 28 additions & 0 deletions wasm_web/.package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "tiny-prng-wasm",
"type": "module",
"collaborators": [
"Suzume Nomura <SuzuME@ea.g1e.org>"
],
"description": "PRNG in the browser stack",
"version": "0.2.5",
"license": "MIT OR Apache-2.0",
"files": [
"tiny_prng_wasm_bg.wasm",
"tiny_prng_wasm.js",
"tiny_prng_wasm_bg.js",
"tiny_prng_wasm.d.ts"
],
"main": "tiny_prng_wasm.js",
"types": "tiny_prng_wasm.d.ts",
"sideEffects": [
"./tiny_prng_wasm.js",
"./snippets/*"
],
"keywords": [
"rand",
"prng",
"random-number-generator",
"wasm"
]
}
4 changes: 2 additions & 2 deletions wasm_web/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "tiny-prng-wasm"
version = "0.2.4"
version = "0.2.5"
authors = ["Suzume Nomura <SuzuME@ea.g1e.org>"]
description = "PRNG in the browser stack"
edition = "2024"
license = "MIT OR Apache-2.0"
keywords = ["rand","prng","random-number-generator","wasm"]
keywords = ["rand", "prng", "random-number-generator", "wasm"]

[lib]
crate-type = ["cdylib", "rlib"]
Expand Down
15 changes: 9 additions & 6 deletions wasm_web/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
inp := ./www/node_modules/tiny-prng-wasm
demodir := ./demo
inp := $(demodir)/node_modules/tiny-prng-wasm

all: clean build serve
build:
wasm-pack build;
test ! -d $(inp) || rm -rv $(inp);
cp -rv pkg/ $(inp);
cargo build --release --target wasm32-unknown-unknown \
&& wasm-bindgen --typescript --out-dir pkg ../target/wasm32-unknown-unknown/release/tiny_prng_wasm.wasm \
&& test ! -d $(inp) || rm -rv $(inp); \
[ -d $(inp) ] || mkdir -vp $(inp) \
&& cp -rv .package.json pkg/package.json && cp -rv pkg/ $(inp);
serve:
cd www && yarn install && yarn start
cd $(demodir) && yarn install && yarn start
test:
wasm-pack test --headless --firefox
clean:
test -d pkg && rm -rv pkg www/node_modules/tiny-prng www/node_modules/tiny-prng-wasm || :
test -d pkg && rm -rv pkg $(inp) || :
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.