Skip to content

Commit 836ba1b

Browse files
committed
Update CLI to TypeScript
1 parent 7421b61 commit 836ba1b

31 files changed

+393
-233
lines changed

.github/workflows/main.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ jobs:
164164
- uses: actions/checkout@v4
165165
with:
166166
submodules: true
167+
- name: Set up Node LTS
168+
uses: actions/setup-node@v3
169+
with:
170+
node-version: 'lts/*'
171+
- run: npm ci
167172
- name: Install Rust 1.81.0
168173
run: |
169174
rustup toolchain install 1.81.0
@@ -174,6 +179,8 @@ jobs:
174179
with:
175180
path: "/home/runner/.cargo/bin/wasm-tools"
176181
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
182+
- name: Build CLI
183+
run: npm run build:cli
177184
- name: Build with full debug info
178185
run: npm run build:debug:info
179186
- uses: actions/upload-artifact@v4
@@ -193,6 +200,11 @@ jobs:
193200
- uses: actions/checkout@v4
194201
with:
195202
submodules: true
203+
- name: Set up Node LTS
204+
uses: actions/setup-node@v3
205+
with:
206+
node-version: 'lts/*'
207+
- run: npm ci
196208
- name: Install Rust 1.81.0
197209
run: |
198210
rustup toolchain install 1.81.0
@@ -203,6 +215,8 @@ jobs:
203215
with:
204216
path: "/home/runner/.cargo/bin/wasm-tools"
205217
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
218+
- name: Build CLI
219+
run: npm run build:cli
206220
- name: Build
207221
if: matrix.profile == 'release'
208222
run: npm run build:release
@@ -229,9 +243,11 @@ jobs:
229243
- uses: actions/checkout@v4
230244
with:
231245
submodules: true
232-
- uses: actions/setup-node@v3
246+
- name: Set up Node LTS
247+
uses: actions/setup-node@v3
233248
with:
234249
node-version: 'lts/*'
250+
- run: npm ci
235251

236252
- name: Download Engine
237253
uses: actions/download-artifact@v4
@@ -250,8 +266,9 @@ jobs:
250266
with:
251267
path: "/home/runner/.cargo/bin/wasm-tools"
252268
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
253-
254-
- run: npm install
269+
270+
- name: Build CLI
271+
run: npm run build:cli
255272

256273
- name: Build WPT runtime
257274
run: tests/wpt-harness/build-wpt-runtime.sh --debug-build
@@ -277,9 +294,11 @@ jobs:
277294
- uses: actions/checkout@v4
278295
with:
279296
submodules: true
280-
- uses: actions/setup-node@v3
297+
- name: Set up Node LTS
298+
uses: actions/setup-node@v3
281299
with:
282300
node-version: 'lts/*'
301+
- run: npm ci
283302

284303
- name: Download Engine
285304
uses: actions/download-artifact@v4
@@ -305,7 +324,8 @@ jobs:
305324
path: "/home/runner/.cargo/bin/wasm-tools"
306325
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
307326

308-
- run: npm install
327+
- name: Build CLI
328+
run: npm run build:cli
309329

310330
- name: Build WPT runtime
311331
run: tests/wpt-harness/build-wpt-runtime.sh ${{matrix.profile == 'weval' && '--enable-experimental-aot' || matrix.profile == 'debug' && '--debug-build' || ''}}

.github/workflows/release-please.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ jobs:
8989
- uses: actions/checkout@v3
9090
with:
9191
submodules: true
92+
- name: Set up Node LTS
93+
uses: actions/setup-node@v3
94+
with:
95+
node-version: 'lts/*'
96+
- run: npm ci
9297
- name: Install Rust 1.81.0
9398
run: |
9499
rustup toolchain install 1.81.0
@@ -99,6 +104,8 @@ jobs:
99104
with:
100105
path: "/home/runner/.cargo/bin/wasm-tools"
101106
key: crate-cache-wasm-tools-${{ env.wasm-tools_version }}
107+
- name: Build CLI
108+
run: npm run build:cli
102109
- name: Build
103110
if: ${{ matrix.profile == 'release' }}
104111
run: npm run build:release

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# TypeScript build output
2+
dist/
3+
14
# Integration Tests build output
25
/integration-tests/**/fixtures/**/*.tar.gz
36
/integration-tests/**/fixtures/**/fastly.toml

DEVELOPMENT.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ To build from source, you need to have the following tools installed to successf
3333
```sh
3434
sudo apt install binaryen
3535
```
36-
- rust target wasm32-wasi
36+
- rust target wasm32-wasip1
3737
```sh
38-
rustup target add wasm32-wasi
38+
rustup target add wasm32-wasip1
3939
```
4040
- [cbindgen](https://github.com/eqrion/cbindgen#quick-start)
4141
```sh
@@ -87,9 +87,9 @@ npm run build
8787
# then, restart shell or run:
8888
source $HOME/.cargo/env
8989
```
90-
- rust target wasm32-wasi
90+
- rust target wasm32-wasip1
9191
```sh
92-
rustup target add wasm32-wasi
92+
rustup target add wasm32-wasip1
9393
```
9494
- [cbindgen](https://github.com/eqrion/cbindgen#quick-start)
9595
```sh
@@ -180,10 +180,10 @@ In addition the following flags can be added after the command (passed via `npm
180180
A typical development test command is therefore something like:
181181

182182
```
183-
npm run build:debug && npm run test:integration -- --debug-build --debug-log --local --bail /crypto
183+
npm run build:cli && npm run build:debug && npm run test:integration -- --debug-build --debug-log --local --bail /crypto
184184
```
185185

186-
Which would run a debug build, enable debugging logging, and then that build against all the crypto tests locally on Viceroy, throwing an error as soon as one is found.
186+
Which would build the CLI TypeScript to JavaScript, run a debug build, enable debugging logging, and then that build against all the crypto tests locally on Viceroy, throwing an error as soon as one is found.
187187

188188
Some tests can only be run on Compute and not Viceroy and will be automatically skipped. A green tick is always shown for a test that ran successfully - if it is missing that means it did not run.
189189

integration-tests/cli/env.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'brittle';
2-
import { EnvParser } from '../../src/env.js';
2+
import { EnvParser } from '../../dist/env.js';
33

44
test('EnvParser should parse single key-value pair', function (t) {
55
const parser = new EnvParser();

integration-tests/js-compute/fixtures/app/fastly.toml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "js-test-app"
99
service_id = ""
1010

1111
[scripts]
12-
build = "node ../../../../js-compute-runtime-cli.js --env FASTLY_DEBUG_LOGGING,ACL_NAME,CONFIG_STORE_NAME,DICTIONARY_NAME,KV_STORE_NAME,SECRET_STORE_NAME,LOCAL_TEST,TEST=\"foo\" --enable-experimental-high-resolution-time-methods src/index.js"
12+
build = "node ../../../../dist/cli/js-compute-runtime-cli.js --env FASTLY_DEBUG_LOGGING,ACL_NAME,CONFIG_STORE_NAME,DICTIONARY_NAME,KV_STORE_NAME,SECRET_STORE_NAME,LOCAL_TEST,TEST=\"foo\" --enable-experimental-high-resolution-time-methods src/index.js"
1313

1414
[local_server]
1515

integration-tests/js-compute/fixtures/module-mode/fastly.toml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "js-test-app"
99
service_id = ""
1010

1111
[scripts]
12-
build = "node ../../../../js-compute-runtime-cli.js --env FASTLY_DEBUG_LOGGING,ACL_NAME,CONFIG_STORE_NAME,DICTIONARY_NAME,KV_STORE_NAME,SECRET_STORE_NAME,LOCAL_TEST,TEST=\"foo\" --enable-experimental-high-resolution-time-methods --module-mode src/index.js"
12+
build = "node ../../../../dist/cli/js-compute-runtime-cli.js --env FASTLY_DEBUG_LOGGING,ACL_NAME,CONFIG_STORE_NAME,DICTIONARY_NAME,KV_STORE_NAME,SECRET_STORE_NAME,LOCAL_TEST,TEST=\"foo\" --enable-experimental-high-resolution-time-methods --module-mode src/index.js"
1313

1414
[local_server]
1515

package-lock.json

Lines changed: 48 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)