Skip to content

Commit 375b262

Browse files
committed
fix(wasm): rename publishable package and modernize release path v1.16.14
1 parent dbba975 commit 375b262

16 files changed

Lines changed: 362 additions & 53 deletions

File tree

.github/workflows/ci-main.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,17 +305,18 @@ jobs:
305305
targets: wasm32-unknown-unknown
306306

307307
- name: Install wasm-pack
308-
uses: jetli/wasm-pack-action@v0.4.0
309-
with:
310-
version: 'latest'
308+
run: |
309+
if ! command -v wasm-pack >/dev/null 2>&1; then
310+
cargo install wasm-pack --locked
311+
fi
311312
312313
- name: Build WASM for web
313314
run: |
314315
./scripts/build-wasm.sh web release
315316
316317
# Show WASM artifacts
317-
ls -la crates/terraphim_automata/wasm-test/pkg/
318-
du -sh crates/terraphim_automata/wasm-test/pkg/*.wasm
318+
ls -la crates/terraphim_automata/wasm/pkg/
319+
du -sh crates/terraphim_automata/wasm/pkg/*.wasm
319320
320321
- name: Build WASM for Node.js
321322
run: |
@@ -325,7 +326,7 @@ jobs:
325326
uses: actions/upload-artifact@v4
326327
with:
327328
name: wasm-package
328-
path: crates/terraphim_automata/wasm-test/pkg/
329+
path: crates/terraphim_automata/wasm/pkg/
329330
retention-days: ${{ needs.setup.outputs.is-release == 'true' && '90' || '30' }}
330331

331332
# Docker image build

.github/workflows/ci-pr.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,10 @@ jobs:
422422
targets: wasm32-unknown-unknown
423423

424424
- name: Install wasm-pack
425-
uses: jetli/wasm-pack-action@v0.4.0
426-
with:
427-
version: 'latest'
425+
run: |
426+
if ! command -v wasm-pack >/dev/null 2>&1; then
427+
cargo install wasm-pack --locked
428+
fi
428429
429430
- name: Build WASM
430431
run: |

.github/workflows/publish-wasm.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
runs-on: ubuntu-latest
3333
defaults:
3434
run:
35-
working-directory: crates/terraphim_automata/wasm-test
35+
working-directory: crates/terraphim_automata/wasm
3636

3737
steps:
3838
- name: Checkout repository
@@ -51,9 +51,10 @@ jobs:
5151
scope: '@terraphim'
5252

5353
- name: Install wasm-pack
54-
uses: jetli/wasm-pack-action@v0.4.0
55-
with:
56-
version: latest
54+
run: |
55+
if ! command -v wasm-pack >/dev/null 2>&1; then
56+
cargo install wasm-pack --locked
57+
fi
5758
5859
- name: Determine publish version
5960
id: version
@@ -76,7 +77,7 @@ jobs:
7677
run: wasm-pack build --release --target web
7778

7879
- name: Set npm package metadata
79-
working-directory: crates/terraphim_automata/wasm-test/pkg
80+
working-directory: crates/terraphim_automata/wasm/pkg
8081
run: |
8182
npm pkg set name='@terraphim/automata-wasm'
8283
npm pkg set publishConfig.registry='https://npm.pkg.github.com'
@@ -96,7 +97,7 @@ jobs:
9697
echo "NPM_TOKEN=$TOKEN" >> "$GITHUB_ENV"
9798
9899
- name: Publish wasm package
99-
working-directory: crates/terraphim_automata/wasm-test/pkg
100+
working-directory: crates/terraphim_automata/wasm/pkg
100101
env:
101102
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
102103
run: |

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,8 @@ cargo install wasm-pack
573573
- ✅ Compatible with Chrome 57+, Firefox 52+, Safari 11+
574574

575575
**Example WASM directory:**
576-
- `crates/terraphim_automata/wasm-test/` - Complete WASM example with tests
577-
- See `crates/terraphim_automata/wasm-test/README.md` for detailed usage
576+
- `crates/terraphim_automata/wasm/` - Publishable WASM package with validation tests
577+
- See `crates/terraphim_automata/wasm/README.md` for detailed usage
578578

579579
### Testing
580580
```bash

Cargo.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ exclude = [
3131
default-members = ["terraphim_server"]
3232

3333
[workspace.package]
34-
version = "1.16.13"
34+
version = "1.16.14"
3535
edition = "2024"
3636

3737
[workspace.dependencies]

crates/terraphim_automata/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6868
- Thesaurus loading (local and remote)
6969
- WASM browser integration
7070
- README with quick start guide
71-
- WASM example project in `wasm-test/`
71+
- WASM package project in `wasm/`
7272

7373
### WASM Support
7474
- Full browser compatibility
7575
- TypeScript type definitions
76-
- Example integration at `wasm-test/`
76+
- Example integration at `wasm/`
7777
- Compatible with Chrome 57+, Firefox 52+, Safari 11+
7878
- ~200KB compressed bundle size (release build)
7979

crates/terraphim_automata/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ const results = fuzzy_autocomplete_search(index, "rast", 0.8, 5);
159159
console.log("Matches:", results);
160160
```
161161

162-
See [wasm-test/](wasm-test/) for a complete example.
162+
See [wasm/](wasm/) for the publishable WebAssembly package and browser example.
163163

164164
## Cargo Features
165165

crates/terraphim_automata/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
//! wasm-pack build --target web --features wasm
104104
//! ```
105105
//!
106-
//! See the [WASM example](wasm-test/) for browser usage.
106+
//! See the [WASM package](wasm/) for browser usage.
107107
108108
pub use self::builder::{Logseq, ThesaurusBuilder};
109109
pub mod autocomplete;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
[package]
2+
name = "terraphim-automata-wasm"
3+
version = "1.0.0"
4+
edition = "2021"
5+
authors = ["Terraphim Contributors"]
6+
description = "WebAssembly bindings for terraphim_automata"
7+
license = "Apache-2.0"
8+
repository = "https://github.com/terraphim/terraphim-ai"
9+
10+
# Standalone package, not part of parent workspace
11+
[workspace]
12+
13+
[lib]
14+
crate-type = ["cdylib", "rlib"]
15+
16+
[dependencies]
17+
terraphim_automata = { path = "..", features = ["wasm"] }
18+
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
19+
serde = { version = "1.0", features = ["derive"] }
20+
serde_json = "1.0"
21+
serde-wasm-bindgen = "0.6"
22+
console_error_panic_hook = "0.1"
23+
wasm-logger = "0.2"
24+
log = "0.4"
25+
26+
js-sys = "0.3"
27+
web-sys = { version = "0.3", features = ["console"] }
28+
29+
[dev-dependencies]
30+
wasm-bindgen-test = "0.3"
31+
32+
[package.metadata.wasm-pack.profile.release]
33+
# Disable wasm-opt: the version bundled with wasm-pack is too old
34+
# to handle reference-types / bulk-memory WASM features produced by
35+
# recent Rust toolchains ("Only 1 table definition allowed in MVP").
36+
wasm-opt = false
37+
38+
[profile.release]
39+
# Optimize for small code size
40+
opt-level = "s"
41+
lto = true

0 commit comments

Comments
 (0)