iotaledger / iotaledger/identity

[Task] Improve compile-time error when `wasm-bindgen-cli` version is out of sync.

Open
#1,113 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
346
Forks
100
Avg merge
13h 41m
Merged PRs (30d)
2

Description

## Description
Consider adding a build script that crashes with a good error message if there is a version mismatch between the `wasm-bindgen` dependency and `wasm-bindgen-cli`. Either a `build.rs` in the `bindings/wasm` directory or something JS-based in the `build` folder could work.

Although mainly intended for local development, such a script might help the CI as well since it occasionally falls back to downloading an older version of the `cli` and the build action then later panics with a rather vague error message.

Whether it would make sense to upstream such a script to `wasm-bindgen` is not yet clear to me. It is probably not necessary for the many people who build their wasm binaries using `wasm-pack`.

## Motivation
If one attempts to build the bindings using an out-of-sync (or at least older version) of `wasm-bindgen-cli` than `wasm-bindgen` a panic with an unhelpful error message occurs. It would be nice to help developers avoid wasting their time debugging this.

## Resources
This [issue in the wasm-bindgen repo](https://github.com/rustwasm/wasm-bindgen/issues/2619) is somewhat related.

## To-do list
Create a task-specific to-do list. Please link PRs that match the TODO list item behind the item after it has been submitted.

- [ ] Item one
- [ ] Item two
- [ ] Item three

## Change checklist
Add an `x` to the boxes that are relevant to your changes, and delete any items that are not.

- [ ] The feature or fix is implemented in Rust and across all bindings whereas possible.
- [ ] The feature or fix has sufficient testing coverage
- [ ] All tests and examples build and run locally as expected
- [ ] Every piece of code has been document according to the documentation guidelines.
- [ ] If conceptual documentation (mdbook) and examples highlighting the feature exist, they are properly updated.
- [ ] If the feature is not currently documented, a documentation task Issue has been opened to address this.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the bindings/wasm directory and the build folder to determine whether the project uses a Rust build.rs or JavaScript build step. Compare the wasm-bindgen dependency and CLI versions during the build, and review the linked wasm-bindgen issue for context. Done means an out-of-sync CLI produces a clear compile-time error instead of the reported vague panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.