-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·38 lines (30 loc) · 901 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
rm -rf pkg
wasm-pack build --target=no-modules --mode no-install || exit 1
mkdir tmp-target
mkdir tmp-target/firefox
mkdir tmp-target/chrome
cp pkg/* tmp-target/firefox
mv pkg/* tmp-target/chrome
mv tmp-target/* pkg
rm -rf tmp-target
cp firefox_manifest_v3.json pkg/firefox/manifest.json
cp chrome_manifest_v3.json pkg/chrome/manifest.json
cp background-worker.js pkg/firefox/background-worker.js
cp background-worker.js pkg/chrome/background-worker.js
cp icons/* pkg/firefox/
cp icons/* pkg/chrome/
printf "
const runtime = chrome.runtime || browser.runtime;
async function run() {
await wasm_bindgen(runtime.getURL('hackernews_userscript_bg.wasm'));
}
run();
" >> pkg/firefox/run_wasm.js
printf "
const runtime = chrome.runtime || browser.runtime;
async function run() {
await wasm_bindgen(runtime.getURL('hackernews_userscript_bg.wasm'));
}
run();
" >> pkg/chrome/run_wasm.js