From 11a3eec49cac7ced40af59881add50824d4830dc Mon Sep 17 00:00:00 2001 From: Brian Carroll Date: Wed, 13 Sep 2023 08:37:27 +0100 Subject: [PATCH] Tweak local dev instructions for repl_wasm --- crates/repl_wasm/README.md | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/crates/repl_wasm/README.md b/crates/repl_wasm/README.md index 7094aa8ac7..be6731426c 100644 --- a/crates/repl_wasm/README.md +++ b/crates/repl_wasm/README.md @@ -2,41 +2,27 @@ ## Running locally -### 1. Build the Roc website - -For a minimal build (when just working on the web REPL) - -```bash -cp -r www/public www/build -``` - -Or, for a full build (with std lib documentation, downloadable source code, etc.) - -```bash -www/build.sh -``` - -### 2. Build the web REPL +### 1. Build the web REPL This builds the compiler as a `.wasm` file, and generates JS glue code. It will `cargo install` the `wasm-pack` command line tool if you don't already have it. -You should run it from the project root directory. ```bash crates/repl_wasm/build-www.sh ``` -### 3. Make symlinks to the generated Wasm and JS +### 2. Make symlinks to the generated Wasm and JS + ```bash cd www/public ln -s ../../../crates/repl_wasm/build/roc_repl_wasm_bg.wasm ln -s ../../../crates/repl_wasm/build/roc_repl_wasm.js ``` These symlinks are ignored by Git. -This is slightly different from how we do the production build but it makes development easy. -You can directly edit files like repl.js and just reload your browser to see changes. -### 4. Run a local HTTP server +> This is a bit different from the production build, where we copy all the files to `www/build/`. But for development, it's convenient to have just one copy of files like `www/public/repl.js`. You can make changes, reload your browser to see them, and commit them to Git, without getting mixed up between different copies of the same file. + +### 3. Run a local HTTP server Browsers won't load .wasm files over the `file://` protocol, so you need to serve the files in `./www/build/` from a local web server. Any server will do, but this example should work on any system that has Python 3 installed: @@ -46,7 +32,7 @@ cd www/public python3 -m http.server ``` -### 5. Open your browser +### 4. Open your browser You should be able to find the Roc REPL at (or whatever port your web server mentioned when it started up.)