@ekotek/core-testing-interaction
v0.1.0
Published
Minimal cross-platform string echo core
Readme
core-testing-interaction
core-testing-interaction is a small Rust library with one operation:
assert_eq!(core_testing_interaction::echo("hello".to_owned()), "hello");echo accepts one String and returns exactly that value, including empty and
Unicode strings.
Build and test
cargo testPlatform packages
All generated artifacts are written beneath target/.
| Platform | Command | Output |
| --- | --- | --- |
| iOS | scripts/build-ios.sh | target/<triple>/release/ libraries and target/bindings/ios/core_testing_interaction.swift |
| Android | scripts/build-android.sh | target/<triple>/release/ libraries and target/bindings/android/uniffi/core_testing_interaction/core_testing_interaction.kt |
| WebAssembly | scripts/build-wasm.sh | target/wasm/core_testing_interaction_bg.wasm and browser JavaScript/TypeScript glue |
The iOS and Android scripts use the crate-local UniFFI generator, so no global
uniffi-bindgen installation is required. The WebAssembly script requires
wasm-bindgen 0.2.127:
cargo install wasm-bindgen-cli --version 0.2.127 --lockedPublishing the WebAssembly package to npm
The web team consumes this crate as an npm package. scripts/publish-wasm.sh
builds it with wasm-pack and publishes it to npm as a public scoped package
(@ekotek/core-testing-interaction by default).
Prerequisites:
cargo install wasm-pack
rustup target add wasm32-unknown-unknown
npm login # or set NODE_AUTH_TOKEN in the environment for CIThe @ekotek organization must exist on npmjs.com and your account must be a
member (create it at npmjs.com → "Add Organization"). Then:
scripts/publish-wasm.sh # build + publish
DRY_RUN=1 scripts/publish-wasm.sh # build + `npm publish --dry-run` only
NPM_SCOPE=myorg scripts/publish-wasm.sh # publish under a different scopeBump version in Cargo.toml before each publish — npm rejects re-publishing
an existing version. The web team then installs and calls it:
npm install @ekotek/core-testing-interactionimport { echo } from "@ekotek/core-testing-interaction";
console.log(echo("xin chào 👋")); // "xin chào 👋"The bundler target used here needs no manual init() call under Webpack,
Vite, or Rollup.
Prerequisites
Install the Rust target for every architecture you intend to package. The scripts cover these targets:
rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios
rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android
rustup target add wasm32-unknown-unknowniOS builds must run on macOS with Xcode installed so Cargo can use the iPhoneOS
SDK. Android builds need an Android NDK and Cargo linkers configured for each
Android target (for example, through cargo-ndk or target-specific
CARGO_TARGET_*_LINKER variables). WASM builds need only the Rust target and
the pinned wasm-bindgen CLI above.
