forked from dhowe/AdNauseam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-webext.sh
executable file
·66 lines (53 loc) · 2.08 KB
/
make-webext.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
#
# This script assumes a linux environment
echo "*** AdNauseam::WebExt: Creating web store package"
echo "*** AdNauseam::WebExt: Copying files"
DES=dist/build/adnauseam.webext
rm -rf $DES
mkdir -p $DES/webextension
VERSION=`jq .version manifest.json` # top-level adnauseam manifest
UBLOCK=`jq .version platform/chromium/manifest.json | tr -d '"'` # ublock-version no quotes
bash ./tools/make-assets.sh $DES
bash ./tools/make-locales.sh $DES
cp -R src/css $DES/
cp -R src/img $DES/
cp -R src/js $DES/
cp -R src/lib $DES/
#cp -R src/_locales $DES/
#cp -R $DES/_locales/nb $DES/_locales/no
cp src/*.html $DES/
cp platform/chromium/*.js $DES/js/
cp -R platform/chromium/img $DES/
cp platform/chromium/*.html $DES/
cp platform/chromium/*.json $DES/
cp LICENSE.txt $DES/
cp platform/webext/manifest.json $DES/
cp platform/webext/polyfill.js $DES/js/
cp platform/webext/vapi-webrequest.js $DES/js/
cp platform/webext/vapi-cachestorage.js $DES/js/
cp platform/webext/vapi-usercss.js $DES/js/
echo "*** AdNauseam.webext: concatenating content scripts"
cat $DES/js/vapi-usercss.js > /tmp/contentscript.js
echo >> /tmp/contentscript.js
grep -v "^'use strict';$" $DES/js/contentscript.js >> /tmp/contentscript.js
mv /tmp/contentscript.js $DES/js/contentscript.js
rm $DES/js/vapi-usercss.js
# Webext-specific
rm $DES/img/icon_128.png
rm $DES/options_ui.html
rm $DES/js/options_ui.js
echo "*** AdNauseam::WebExt: Generating meta..."
# python tools/make-webext-meta.py $DES/ ADN: use our own version
#
sed -i '' "s/\"{version}\"/${VERSION}/" $DES/manifest.json
sed -i '' "s/{UBLOCK_VERSION}/${UBLOCK}/" $DES/popup.html
sed -i '' "s/{UBLOCK_VERSION}/${UBLOCK}/" $DES/links.html
if [ "$1" = all ]; then
echo "*** AdNauseam::WebExt: Creating package..."
pushd $(dirname $DES/) > /dev/null
zip adnauseam.webext.zip -qr $(basename $DES/)/*
popd > /dev/null
fi
echo "*** AdNauseam::WebExt: Package done."
echo