Skip to content

Fix modern build and automated npm publishing - #50

Merged
j4ys0n merged 1 commit into
mainfrom
agent/fix-build-publish
Jul 17, 2026
Merged

Fix modern build and automated npm publishing#50
j4ys0n merged 1 commit into
mainfrom
agent/fix-build-publish

Conversation

@j4ys0n

@j4ys0n j4ys0n commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • update the locked Rust/Wasm toolchain so the package builds with modern Rust and Node.js
  • replace the obsolete generated wasm-bindgen internal import with a stable exported memory accessor
  • produce a clean top-level Wasm package and exclude Rust build artifacts from the npm tarball
  • pin the CI toolchain and publish evmdecoder from GitHub Actions after changes land on main
  • publish the next release as 0.0.72

Root cause

The Rust lockfile pinned wasm-bindgen 0.2.58, which current Rust rejects because versions older than 0.2.88 are incompatible. Updating wasm-bindgen also removed the generated *_bg.js module that the TypeScript bridge imported directly.

The prior npm files configuration included the entire wasm directory, so the tarball contained the Rust target tree and host-specific build products.

Impact

The package now builds on Apple Silicon with Node 22 and Rust 1.91.1, generates a portable Node.js Wasm runtime, and publishes a small reproducible npm package through GitHub Actions. The workflow fails clearly when package.json has not been bumped to an unpublished version.

Validation

  • npm run build
  • npm test -- --runInBand: 12 suites, 36 tests, 92 snapshots
  • cargo test --locked
  • cargo install wasm-pack --version 0.13.1 --locked in an isolated prefix
  • npm pack audit: 61 files, 2.52 MB packed / 2.78 MB unpacked; Wasm runtime included and Rust target artifacts excluded
  • installed the generated tarball into a clean temporary consumer project
  • executed packaged SHA-3 and Wasm memory APIs successfully

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the Rust/Wasm build for evmdecoder, updates the JS/TS bridge to rely on stable wasm-bindgen exports, and introduces an automated npm publish workflow for releases from main.

Changes:

  • Updates the wasm/ethabi Rust/Wasm toolchain and serialization approach (moves off wasm-bindgen’s deprecated serde integration to serde-wasm-bindgen).
  • Replaces the internal generated *_bg memory import with an explicit exported wasm_memory() accessor and updates TS imports to the new wasm-pkg output directory.
  • Adds a GitHub Actions workflow to publish to npm on main and adjusts packaging to exclude Rust build artifacts while including the generated Wasm runtime.

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
wasm/ethabi/src/lib.rs Switches JS serialization to serde-wasm-bindgen and exports wasm_memory() for stable memory access.
wasm/ethabi/Cargo.toml Updates serde deps and adds serde-wasm-bindgen; removes obsolete wasm-bindgen serde feature and wasm test dep.
wasm/ethabi/Cargo.lock Refreshes lockfile for updated wasm-bindgen/serde dependency graph.
wasm/ethabi/alt-package.json Updates wasm package file list to match new wasm-pack outputs (drops generated _bg.js).
src/abi/wasm.ts Imports from new wasm-pkg location and uses wasm_memory() instead of _bg internal import.
rust-toolchain.toml Pins Rust toolchain and wasm target for reproducible builds.
package.json Bumps version to 0.0.72, adjusts repository metadata, and packages wasm-pkg while updating build scripts.
.gitignore Ignores generated /wasm-pkg directory.
.github/workflows/publish.yml Adds a publish-on-main workflow with version gate and provenance publishing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@j4ys0n
j4ys0n merged commit 6262470 into main Jul 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants