Skip to content

Commit 00c854d

Browse files
authored
[PM-27740] Wrap wasm-bindgen CLI (#330)
## 🎟️ Tracking https://bitwarden.atlassian.net/browse/PM-27740 ## 📔 Objective Previously devs would need to install a version of `wasm-bindgen-cli` that matches with the version of `wasm-bindgen` used by the project. This step produces significant friction, specially when `wasm-bindgen` gets updated, as we need to deal with updating the CI files, and every dev needs to update their environment. It also introduces another avenue for builds to be non-reproducible. This PR tries to do something similar to what `uniffi` does, in that we have a simple [wrapper crate](https://github.com/bitwarden/sdk-internal/tree/main/crates/uniffi-bindgen) around the utility. This means that the crate gets versioned in the `Cargo.lock` like every other dependency. While I was at it, I've also updated the renovate config to group all the wasm-bindgen crates together, and I've also included a small TS formatting error that was reported in #319. The reason we never saw it is that we always run prettier after, which gets rid of the extra semicolon. Fixes #319. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
1 parent 32a8d8a commit 00c854d

File tree

15 files changed

+444
-27
lines changed

15 files changed

+444
-27
lines changed

.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ rustflags = ["--cfg", "aes_armv8"]
66

77
[target.wasm32-unknown-unknown]
88
rustflags = ['--cfg', 'getrandom_backend="wasm_js"']
9-
runner = 'wasm-bindgen-test-runner'
9+
runner = 'cargo run -p wasm-bindgen-cli-runner --bin wasm-bindgen-test-runner'
1010

1111
# Enable support for 16k pages on Android, JNA is using these same flags
1212
# https://android-developers.googleblog.com/2024/08/adding-16-kb-page-size-to-android.html

.github/renovate.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
"groupName": "pyo3 non-major",
2222
"matchPackageNames": ["/pyo3*/"]
2323
},
24+
{
25+
"matchManagers": ["cargo"],
26+
"groupName": "wasm-bindgen group",
27+
"matchPackageNames": ["/wasm-bindgen*/"]
28+
},
2429
{
2530
"groupName": "dockerfile minor",
2631
"matchManagers": ["dockerfile"],

.github/workflows/build-wasm-internal.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
- "hotfix-rc"
1010
workflow_dispatch:
1111

12+
permissions: {}
13+
1214
defaults:
1315
run:
1416
shell: bash
@@ -91,9 +93,6 @@ jobs:
9193
with:
9294
key: wasm-cargo-cache
9395

94-
- name: Install wasm-bindgen-cli
95-
run: cargo install wasm-bindgen-cli --version 0.2.105 --locked
96-
9796
- name: Build
9897
run: ./build.sh -r ${{ matrix.license_type.build_flags }}
9998

.github/workflows/rust-test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ jobs:
7777
- name: Cache cargo registry
7878
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
7979

80-
- name: Install wasm-bindgen-cli
81-
run: cargo install wasm-bindgen-cli --version 0.2.105 --locked
82-
8380
- name: Test WASM
8481
run: cargo test --target wasm32-unknown-unknown -p bitwarden-wasm-internal -p bitwarden-threading -p bitwarden-error -p bitwarden-uuid --all-features
8582

0 commit comments

Comments
 (0)