From 15aec0d4c86af2459bb502013c44561ab169ec13 Mon Sep 17 00:00:00 2001 From: Daniel Salinas Date: Fri, 30 May 2025 10:21:23 -0400 Subject: [PATCH] Web build for ubrn ``` yarn install yarn ubrn:checkout yarn ubrn:web:build // Will fail, edit rust_modules/matrix-rust-sdk/Cargo.toml to include bindings/wasm in the build targets yarn ubrn:web:build ``` --- package.json | 5 ++-- ubrn.yaml | 10 +++++--- yarn.lock | 72 ++++++++++++++++++++++++++-------------------------- 3 files changed, 46 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index 7ba5ce9..8adb141 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@unomed/react-native-matrix-sdk", + "name": "react-native-matrix-sdk", "version": "0.5.0", "description": "⚡️ FFI bindings for matrix-rust-sdk in a React Native Turbo Module ⚡️", "source": "./src/index.tsx", @@ -44,6 +44,7 @@ "ubrn:ios:build": "CARGO_FEATURE_NO_NEON=1 ubrn build ios --config ubrn.yaml --native-bindings", "ubrn:ios:build:release": "yarn ubrn:ios:build --release", "ubrn:ios:generate": "ubrn generate all --config ubrn.yaml build/RnMatrixRustSdk.xcframework/ios-arm64/libmatrix_sdk_ffi.a && del-cli swift && mv ios/swift swift && (cd example/ios && pod install)", + "ubrn:web:build": "ubrn build web --config ubrn.yaml", "ubrn:checkout": "( test -d rust_modules/matrix-rust-sdk && git -C rust_modules/matrix-rust-sdk reset --hard HEAD ); ubrn checkout --config ubrn.yaml && ( cd rust_modules/matrix-rust-sdk && git apply ../../matrix-rust-sdk.patch )", "ubrn:clean": "del-cli -v cpp android/src/main/java ios \"src/Native*\" src/generated \"src/index.ts*\"", "generate": "yarn ubrn:clean && yarn ubrn:checkout && yarn ubrn:android:build && yarn ubrn:ios:build && yarn ubrn:ios:generate", @@ -100,7 +101,7 @@ "release-it": "^15.0.0", "turbo": "^1.10.7", "typescript": "^5.2.2", - "uniffi-bindgen-react-native": "0.29.0-0" + "uniffi-bindgen-react-native": "git+https://github.com/jhugman/uniffi-bindgen-react-native#ad1e3351459f6acce95d403742999fac1b343e64" }, "resolutions": { "@types/react": "^18.2.44" diff --git a/ubrn.yaml b/ubrn.yaml index 5b88a9e..c9385aa 100644 --- a/ubrn.yaml +++ b/ubrn.yaml @@ -1,8 +1,8 @@ --- crate: - repo: https://github.com/matrix-org/matrix-rust-sdk - rev: bb573117e102261b46da3f2d6761c4b3f51850a7 # matrix-sdk-0.9.0 - manifestPath: bindings/matrix-sdk-ffi/Cargo.toml + repo: https://github.com/filament-dm/matrix-rust-sdk + branch: wasm_mega_pr + manifestPath: bindings/matrix-sdk-ffi-web/Cargo.toml android: cargoExtras: [] directory: android @@ -22,6 +22,10 @@ ios: # - x86_64-apple-ios xcodebuildExtras: [] frameworkName: build/RnMatrixRustSdk +web: + workspace: true + manifestPath: rust_modules/matrix-rust-sdk/bindings/wasm/Cargo.toml + runtimeVersion: 0.29.0-0.1 noOverwrite: [] turboModule: cpp: cpp diff --git a/yarn.lock b/yarn.lock index 77fb357..e48c283 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4541,37 +4541,6 @@ __metadata: languageName: unknown linkType: soft -"@unomed/react-native-matrix-sdk@workspace:.": - version: 0.0.0-use.local - resolution: "@unomed/react-native-matrix-sdk@workspace:." - dependencies: - "@commitlint/config-conventional": ^17.0.2 - "@evilmartians/lefthook": ^1.5.0 - "@react-native-community/cli": 15.0.1 - "@react-native/eslint-config": 0.76.9 - "@release-it/conventional-changelog": ^5.0.0 - "@types/jest": ^29.5.5 - "@types/react": ^18.2.44 - commitlint: ^17.0.2 - del-cli: ^5.1.0 - eslint: ^8.51.0 - eslint-config-prettier: ^9.0.0 - eslint-plugin-prettier: ^5.0.1 - jest: ^29.7.0 - prettier: ^3.0.3 - react: 18.3.1 - react-native: 0.76.9 - react-native-builder-bob: ^0.31.0 - release-it: ^15.0.0 - turbo: ^1.10.7 - typescript: ^5.2.2 - uniffi-bindgen-react-native: 0.29.0-0 - peerDependencies: - react: "*" - react-native: "*" - languageName: unknown - linkType: soft - "JSONStream@npm:^1.0.4, JSONStream@npm:^1.3.5": version: 1.3.5 resolution: "JSONStream@npm:1.3.5" @@ -12244,6 +12213,37 @@ __metadata: languageName: node linkType: hard +"react-native-matrix-sdk@workspace:.": + version: 0.0.0-use.local + resolution: "react-native-matrix-sdk@workspace:." + dependencies: + "@commitlint/config-conventional": ^17.0.2 + "@evilmartians/lefthook": ^1.5.0 + "@react-native-community/cli": 15.0.1 + "@react-native/eslint-config": 0.76.9 + "@release-it/conventional-changelog": ^5.0.0 + "@types/jest": ^29.5.5 + "@types/react": ^18.2.44 + commitlint: ^17.0.2 + del-cli: ^5.1.0 + eslint: ^8.51.0 + eslint-config-prettier: ^9.0.0 + eslint-plugin-prettier: ^5.0.1 + jest: ^29.7.0 + prettier: ^3.0.3 + react: 18.3.1 + react-native: 0.76.9 + react-native-builder-bob: ^0.31.0 + release-it: ^15.0.0 + turbo: ^1.10.7 + typescript: ^5.2.2 + uniffi-bindgen-react-native: "git+https://github.com/jhugman/uniffi-bindgen-react-native#ad1e3351459f6acce95d403742999fac1b343e64" + peerDependencies: + react: "*" + react-native: "*" + languageName: unknown + linkType: soft + "react-native@npm:0.76.9": version: 0.76.9 resolution: "react-native@npm:0.76.9" @@ -14171,13 +14171,13 @@ __metadata: languageName: node linkType: hard -"uniffi-bindgen-react-native@npm:0.29.0-0": +"uniffi-bindgen-react-native@git+https://github.com/jhugman/uniffi-bindgen-react-native#ad1e3351459f6acce95d403742999fac1b343e64": version: 0.29.0-0 - resolution: "uniffi-bindgen-react-native@npm:0.29.0-0" + resolution: "uniffi-bindgen-react-native@https://github.com/jhugman/uniffi-bindgen-react-native.git#commit=ad1e3351459f6acce95d403742999fac1b343e64" bin: - ubrn: bin/cli.cjs - uniffi-bindgen-react-native: bin/cli.cjs - checksum: 0716a1c170ad9b151f2f21d5ec887b3fb984182e6fc2242b19284be92a9fe40e4a00fc8e7b4bc10726bc8ed19a0bd213ec213d0bf52f65ba5016c1c32a0f59cc + ubrn: ./bin/cli.cjs + uniffi-bindgen-react-native: ./bin/cli.cjs + checksum: 9a90ac643eafb73091fc6a7fefc82dd95df470360fe250e69bf8323b83d9ef4279d7b6ca97b02b8c065799f646c0405d47113902ec2e4d84d9d7fcbbd820f259 languageName: node linkType: hard