forked from Smile4ever/Neat-URL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
70 lines (57 loc) · 1.58 KB
/
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
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
67
68
69
70
#!/bin/bash
NEATURLVERSION=$(jq -r '.version' manifest.json)
echo "Building Neat URL $NEATURLVERSION"
echo "Requirements:"
echo "- jq"
echo "- git"
echo "- web-ext"
echo "- npm"
echo "- rename"
if [[ ! -f "browser-polyfill.min.js" ]]; then
git clone https://github.com/mozilla/webextension-polyfill polyfill
cd polyfill
npm install
npm run build
npm run test
cp dist/browser-polyfill.min.js ../browser-polyfill.min.js
cd ..
rm -rf polyfill
fi
rm -rf build 2>/dev/null
# Build ZIP - Chrome
mkdir build
shopt -s extglob # to enable extglob
cp -r !(build*) build/
cd build
rm -rf web-ext-artifacts
jq -r 'del(.applications) | del(.browser_action.browser_style) | del(.options_ui.browser_style)' manifest.json > manifest-chrome.json #Chrome
rm manifest.json #Chrome
mv manifest-chrome.json manifest.json #Chrome
echo ""
echo "Building ZIP for Chrome.."
web-ext build --ignore-files build.sh images *.md *.txt .gitignore
cd web-ext-artifacts
rename zip chrome.zip *.zip
cd ../..
yes | cp build/web-ext-artifacts/* web-ext-artifacts/
rm -rf build/web-ext-artifacts
rm -rf build
# Build ZIP - Firefox
mkdir build
shopt -s extglob # to enable extglob
cp -r !(build*) build/
cd build
rm -rf web-ext-artifacts
rm browser-polyfill.min.js
touch browser-polyfill.min.js
echo ""
echo "Building ZIP for Firefox.."
web-ext build --ignore-files build.sh images *.md *.txt .gitignore
cd web-ext-artifacts
rename zip firefox.zip *.zip
cd ../..
yes | cp build/web-ext-artifacts/* web-ext-artifacts/
rm -rf build
echo ""
echo "Done building Neat URL $NEATURLVERSION:"
find web-ext-artifacts -mmin -1 -type f -print