Wwordcraft-reactv0.3.6
@gamine/wordcraft-react

Building and contributing

Repository layout, building from source and the upstream sync.

crates/wordcraft-embed   Rust: wasm-bindgen API over upstream WordCraft (pinned in UPSTREAM_REV)
crates/wordcraft-collab  Rust: WordCraft documents as a Yjs-compatible CRDT (co-editing)
patches/                 Small hooks applied on top of upstream by scripts/prepare-upstream.sh
packages/wordcraft-react TypeScript: createWordcraft() core, <WordcraftEditor />, and /collab (Yjs)
examples/nextjs          Next.js App Router example, including /collab (co-editing) and its shared-file API
site/                    Documentation and showcase site (Next.js, static, deployed to GitHub Pages)
scripts/build-wasm.sh    Builds the .wasm into packages/wordcraft-react/wasm
scripts/sync-upstream.py Pins a newer upstream WordCraft commit, dependencies 1:1 with upstream
examples/nextjs/smoke-*.mjs     Headless-browser tests: the editor and its API, and two people co-editing
docs/PLAN.md             Plan of action for the WordCraft and GridCraft packages

Building from source

rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli --version 0.2.129 --locked
npm i -g binaryen                 # optional, for the wasm-opt size pass
scripts/build-wasm.sh
cd packages/wordcraft-react && npm install && npm run build && npm test
cd ../../examples/nextjs && npm install && npm run dev

Staying in step with upstream

The Upstream sync workflow runs every two hours, and you can also start it by hand from the Actions tab. When storytold/wordcraft has new commits, it:

  1. pins the new commit, rebases patches/ onto it with a three-way merge (refreshing them) and copies upstream's Cargo.lock, so every shared dependency matches upstream exactly;
  2. rebuilds the WebAssembly and runs every check: Rust lints and tests, the package tests, the Next.js example build, and a headless-browser smoke test that starts the editor and exercises the API;
  3. if everything passes, bumps the patch version, commits, tags vX.Y.Z and publishes to npm through the Release workflow.

If upstream breaks anything, nothing is published. npm keeps serving the last good version, and the workflow opens an issue that links to the failed run. If you'd rather review each update before it ships, set the repository variable UPSTREAM_SYNC_MODE to pr, and the workflow will open a pull request instead of publishing.

To release by hand, bump the patch version in packages/wordcraft-react/package.json, add its CHANGELOG.md section, and push to main; the Release workflow tags it and publishes the section as the release notes. Publishing needs either an NPM_TOKEN repository secret (a granular npm token with publish rights on @gamine) or npm trusted publishing configured for this repository's release.yml. A version that is already on npm is skipped, so re-running a release is safe.

Up next