Skip to content

Commit 9633982

Browse files
build(cdn): Bundle and minify runtime + host JS before deploy.
1 parent d199f7c commit 9633982

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

.github/actions/cdn-deploy/action.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,34 @@ runs:
3232
path: /tmp/cli/
3333
merge-multiple: true
3434

35+
- name: Setup Deno
36+
uses: denoland/setup-deno@v2
37+
with:
38+
deno-version: v2.x
39+
3540
- name: Stage site
3641
shell: bash
3742
run: |
38-
mkdir -p _site/runtime _site/std _site/host _site/cli
43+
mkdir -p _site/std _site/cli
3944
40-
# compiler: the wasm module, served at the CDN root (cdn.edgepython.com/compiler.wasm).
45+
# compiler: served at the CDN root (cdn.edgepython.com/compiler.wasm).
4146
cp /tmp/compiler/compiler.wasm _site/compiler.wasm
4247
43-
# runtime: JS sources; the wasm is loaded from the CDN root, not bundled here.
44-
cp -r runtime/. _site/runtime/
48+
# runtime: bundle + minify the public entries, keep src/ + worker/ layout so the worker URL resolves.
49+
deno run -A npm:esbuild@0.28.0 \
50+
runtime/src/index.js runtime/src/element.js runtime/worker/worker.js \
51+
--bundle --minify --format=esm --platform=browser --target=es2022 \
52+
--legal-comments=none --outbase=runtime --outdir=_site/runtime
4553
4654
# std: <pkg>.wasm / <pkg>.py.
4755
cp -r /tmp/std/. _site/std/
4856
49-
# host: flatten each capability's src/ into _site/host/<cap>/.
57+
# host: bundle + minify each capability into host.edgepython.com/<cap>/index.js.
5058
for dir in host/*/src; do
5159
cap="$(basename "$(dirname "$dir")")"
52-
mkdir -p "_site/host/$cap"
53-
cp -r "$dir"/. "_site/host/$cap/"
60+
deno run -A npm:esbuild@0.28.0 "$dir/index.js" \
61+
--bundle --minify --format=esm --platform=browser --target=es2022 \
62+
--legal-comments=none --outfile="_site/host/$cap/index.js"
5463
done
5564
5665
# cli: release tarballs.

0 commit comments

Comments
 (0)