|
| 1 | +# Building the native crates after `npm install @honeide/editor` |
| 2 | + |
| 3 | +The npm tarball ships the Rust source for every native rendering crate |
| 4 | +(`native/macos/`, `native/ios/`, `native/windows/`, `native/linux/`, |
| 5 | +`native/android/`) so consumers can build them as part of their Perry-AOT |
| 6 | +pipeline. To make those builds resolve, two prerequisites must be in place |
| 7 | +locally — both are Perry-side constraints we hope to remove once Perry ships |
| 8 | +the missing pieces. |
| 9 | + |
| 10 | +## 1. `perry-ffi` must be resolvable to Cargo |
| 11 | + |
| 12 | +The crates' `Cargo.toml` files declare: |
| 13 | + |
| 14 | +```toml |
| 15 | +perry-ffi = { path = "../../../../perry/perry/crates/perry-ffi" } |
| 16 | +``` |
| 17 | + |
| 18 | +That relative path resolves in a **sibling-checkout layout**: |
| 19 | + |
| 20 | +``` |
| 21 | +~/code/ |
| 22 | +├── hone/hone-editor/ ← your fork / clone |
| 23 | +└── perry/perry/ ← Perry monorepo checkout |
| 24 | +``` |
| 25 | + |
| 26 | +After `npm install @honeide/editor`, the editor lands at |
| 27 | +`node_modules/@honeide/editor/`, so the `../../../../perry/...` path no longer |
| 28 | +points anywhere useful. You'll see: |
| 29 | + |
| 30 | +``` |
| 31 | +error: no matching package found for `perry-ffi` |
| 32 | +``` |
| 33 | + |
| 34 | +**Workaround until [PerryTS/perry#1112](https://github.com/PerryTS/perry/issues/1112) lands** (publishing `perry-ffi` to crates.io): |
| 35 | + |
| 36 | +Add a `[patch.crates-io]` to **your workspace's root** `Cargo.toml` pointing |
| 37 | +at a local Perry checkout: |
| 38 | + |
| 39 | +```toml |
| 40 | +[patch.crates-io] |
| 41 | +perry-ffi = { path = "/absolute/path/to/perry-checkout/crates/perry-ffi" } |
| 42 | +``` |
| 43 | + |
| 44 | +Or, if you're a Perry user, add a workspace `Cargo.toml` at your project root |
| 45 | +that includes the editor's native crate as a member and uses the same `[patch]`. |
| 46 | + |
| 47 | +Once Perry publishes `perry-ffi` to crates.io, we'll switch this dep to a |
| 48 | +version-based requirement (`perry-ffi = "0.5"`) and this workaround goes away. |
| 49 | + |
| 50 | +## 2. Building the demos requires the `examples/` directory |
| 51 | + |
| 52 | +Each native crate ships its `examples/` folder in the npm tarball as of |
| 53 | +`@honeide/editor@0.3.1+`. You can run them with: |
| 54 | + |
| 55 | +```bash |
| 56 | +cd node_modules/@honeide/editor/native/macos |
| 57 | +cargo run --example demo_editor |
| 58 | +``` |
| 59 | + |
| 60 | +(Older `@honeide/editor@0.3.0` was missing `examples/` in the tarball even |
| 61 | +though `Cargo.toml` declared `[[example]]` blocks — that gap is fixed in |
| 62 | +0.3.1.) |
| 63 | + |
| 64 | +## Web doesn't need any of this |
| 65 | + |
| 66 | +The web target compiles the editor TS itself to WASM via Perry. The |
| 67 | +"renderer" on web is plain TypeScript (`native/web/dom-ffi.ts`) — no Rust |
| 68 | +crate, no `perry-ffi`, no Cargo. See [`../examples/web/`](../examples/web/) |
| 69 | +for the build pipeline. |
0 commit comments