Welcome to the expr-editor workspace! This project bridges the antonmedv/expr Go evaluation engine with a React-ready CodeMirror frontend utilizing WebAssembly.
This repo is structured as an npm workspace monorepo with three main directories:
/package: The core React Component library (npm install expr-editor). It exports theExprEditorUI piece along with CodeMirror extensions like autocomplete, linting, and WASM fetching logic./demo: A minimal Vite + React application that consumes the local/packagecomponent. Useful for local development and testing./wasm: Go source files and tests representing the core lexer/parser logic that compiles down to the requiredexpr-linter.wasmfile.
Because this is a monorepo, you can manage both the package and demo dependencies from the root directory.
Install all dependencies for both the library and the demo simultaneously:
npm installBuild the package and the demo simultaneously:
npm run buildThis ensures TypeScript compiles to CommonJS/ES Modules inside /package, and the Demo app binds to the fresh build.
Once the package is built, you can run the local demo:
npm run devVisit the provided URL (typically http://localhost:5200 or http://localhost:5173) to view the interactive editor.
Run the testing suites across the workspaces:
npm test(This triggers Vitest inside the package workspace)
To run the Go WebAssembly core tests, navigate to the /wasm folder and run standard Go commands:
cd wasm
go test -v ./...If you modify the Go logic inside /wasm, you will need to re-compile the expr-linter.wasm binary and place it in the package's public directory.
From the /wasm folder, run:
GOOS=js GOARCH=wasm go build -o ../package/public/expr-linter.wasm main.go core.go