Skip to content

Commit 6537480

Browse files
committed
minor: build script
1 parent 7d7bfcd commit 6537480

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

build/build.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
DOC_FILES="../README.md"
4+
IMG_FILES="../src/chrome/assets/logo.png"
5+
6+
# Strip subdirectories for manifest
7+
sed 's/src\/.*\///g' ../manifest.json > temp-chrome-manifest.json
8+
9+
# Fix update url for Chrome manifest
10+
sed -i 's/updates\.xml/src\/updates\/updates.xml/g' temp-chrome-manifest.json
11+
12+
# Strip subdirectories for background.js
13+
sed 's/src\/.*\///g' ../src/js/background.js > temp-background.js
14+
15+
JS_FILES="temp-background.js"
16+
GEN_FILES="$JS_FILES $DOC_FILES $IMG_FILES"
17+
CH_FILES="$GEN_FILES temp-chrome-manifest.json ../src/updates/updates.xml"
18+
FF_FILES="$GEN_FILES temp-ff-manifest.json ../src/updates/updates.json ../src/chrome/assets/logo.png"
19+
20+
NAME="output/fadblock"
21+
22+
# Remove existing files
23+
rm -f $NAME.crx $NAME.xpi
24+
25+
# Generate Chrome .crx extension package
26+
7z a -tzip -mx9 $NAME.crx $CH_FILES
27+
7z rn $NAME.crx temp-chrome-manifest.json manifest.json temp-background.js background.js
28+
29+
# Remove temp files
30+
echo "\nDeleting temp files..."
31+
rm -v temp-chrome-manifest.json temp-ff-manifest.json temp-background.js

0 commit comments

Comments
 (0)