mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-22 08:17:40 +03:00
Tweak local dev instructions for repl_wasm
This commit is contained in:
parent
fc991baf6a
commit
11a3eec49c
@ -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 <http://127.0.0.1:8000/repl> (or whatever port your web server mentioned when it started up.)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user