Skip to content

Commit 523275c

Browse files
authored
Update development docs (#1083)
1 parent baf0a6e commit 523275c

File tree

1 file changed

+42
-28
lines changed

1 file changed

+42
-28
lines changed

DEVELOPMENT.md

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ To build from source, you need to have the following tools installed to successf
2020

2121
#### Linux
2222

23+
- Build tools
24+
```sh
25+
sudo apt install build-essential
26+
```
2327
- Rust
2428
```
2529
curl -so rust.sh https://sh.rustup.rs && sh rust.sh -y
2630
restart shell or run source $HOME/.cargo/env
2731
```
28-
- Build tools
29-
```sh
30-
sudo apt install build-essential
31-
```
3232
- binaryen
3333
```sh
3434
sudo apt install binaryen
@@ -50,14 +50,9 @@ To build from source, you need to have the following tools installed to successf
5050
sudo mv wasi-sdk-20.0/* /opt/wasi-sdk/
5151
```
5252

53-
Once you have those installed, you will need to compile SpiderMonkey:
54-
```
55-
(cd runtime/spidermonkey && bash build-engine.sh)
56-
```
57-
58-
Once that is done, the runtime and the CLI tool for applying it to JS source code can be built using npm:
53+
Build the runtime using npm:
5954
```sh
60-
npm run build && npm run build:starlingmonkey
55+
npm run build && npm run build:debug && npm run build:weval
6156
```
6257

6358
#### macOS (Apple silicon)
@@ -81,9 +76,9 @@ npm run build && npm run build:starlingmonkey
8176
```sh
8277
brew install binaryen
8378
```
84-
- Python 3.11 (Spidermonkey build requires a version before 3.12)
79+
- Python
8580
```sh
86-
brew install python@3.11
81+
brew install python@3
8782
```
8883
- Rust
8984
```sh
@@ -108,18 +103,44 @@ npm run build && npm run build:starlingmonkey
108103
sudo mv wasi-sdk-20.0/* /opt/wasi-sdk/
109104
```
110105

111-
Once you have those installed, you will need to compile SpiderMonkey:
106+
Build the runtime using npm:
112107
```sh
113-
export PATH="/opt/homebrew/opt/[email protected]/libexec/bin:$PATH"
114-
(cd runtime/spidermonkey && bash build-engine.sh)
108+
npm run build && npm run build:debug && npm run build:weval
115109
```
116110

117-
Once that is done, the runtime and the CLI tool for applying it to JS source code can be built using npm:
118-
```sh
119-
npm run build && npm run build:starlingmonkey
120-
```
111+
## Testing a Local build in a Compute application
112+
:warning: **You should not use this for production workloads!!!!!!!!**
113+
114+
You can test a local build of the JS Compute runtime by installing it in your JavaScript Compute application and running that locally or by uploading it to your Fastly service.
121115

122-
## Testing
116+
1. First, follow the directions in [Building the JS Compute Runtime](#building-the-js-compute-runtime) for your platform to obtain a local build. The build outputs are the following files:
117+
- `fastly.wasm`
118+
- `fastly.debug.wasm`
119+
- `fastly-weval.wasm`
120+
- `fastly-ics.wevalcache`
121+
122+
2. Create a local tarball using npm.
123+
```shell
124+
npm pack
125+
```
126+
127+
The resulting tarball will have a filename such as `fastly-js-compute-<version>.tgz`.
128+
129+
3. In your Compute application, install the tarball using `npm`:
130+
```shell
131+
npm install /path/to/fastly-js-compute-<version>.tgz
132+
```
133+
134+
4. Build and test or deploy your application as usual, using `fastly compute serve` or `fastly compute publish`, or an appropriate npm script.
135+
136+
## Testing a Dev Release in a Compute application
137+
:warning: **You should not use this for production workloads!!!!!!!!**
138+
139+
Dev builds are released before production releases to allow for further testing. These are not released upstream to NPM, however you can acquire them from the [Releases](https://github.com/fastly/js-compute-runtime/releases/) section. Download the runtime for your platform, extract the executable and place it in the /node_modules/@fastly/js-compute/bin/PLATFORM folder of your Fastly Compute project. Then you can use the normal [Fastly CLI](https://github.com/fastly/cli) to build your service.
140+
141+
Please submit an [issue](https://github.com/fastly/js-compute-runtime/issues) if you find any problems during testing.
142+
143+
## Automated Testing
123144

124145
The JS Compute Runtime has automated tests which run on all pull-requests. The test applications are located within <./integration-tests/js-compute>.
125146

@@ -129,10 +150,3 @@ To run an end-to-end test which builds and deploys an application to fastly:
129150
- Install the test dependencies: `npm install`
130151
- Get a list of all the applications to test: `node test.js`
131152
- Test a single application via: `node test.js <name>` or test all via `node test.js --all`
132-
133-
## Testing a Dev Release
134-
:warning: **You should not use this for production workloads!!!!!!!!**
135-
136-
Dev builds are released before production releases to allow for further testing. These are not released upstream to NPM, however you can acquire them from the [Releases](https://github.com/fastly/js-compute-runtime/releases/) section. Download the runtime for your platform, extract the executable and place it in the /node_modules/@fastly/js-compute/bin/PLATFORM folder of your Fastly Compute project. Then you can use the normal [Fastly CLI](https://github.com/fastly/cli) to build your service.
137-
138-
Please submit an [issue](https://github.com/fastly/js-compute-runtime/issues) if you find any problems during testing.

0 commit comments

Comments
 (0)