-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.sh
executable file
·71 lines (62 loc) · 1.61 KB
/
package.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
71
#!/usr/bin/env bash
#
# First some sanity checks
#
# Dumb check to make sure we're in the right directory
if [[ ! -a manifest.json || ! -a doc-switcher.css || ! -a books.svg ]]
then
echo "===> Some files missing... are you in the right directory?"
exit 1
fi
# Only package if manifest.json is clean
git status manifest.json | grep -q manifest
if [[ $? -eq 0 ]]
then
echo "===> Commit changes to manifest.json before continuing."
exit
fi
# Remember to change storage back to sync
grep -q 'storage = browser.storage.local' background.js popup/switcher-popup.js
if [[ $? -eq 0 ]]
then
echo "===> Change storage from local to sync before continuing."
exit
fi
# Remember to change debug to false
grep 'debug = true' background.js content-script.js
if [[ $? -eq 0 ]]
then
echo "===> Change debug to false before continuing."
exit
fi
#
# Now make the packages
#
mkdir -p chrome
mkdir -p firefox
# Create zip file for Chrome
echo "Packaging for chrome:"
zip -r -FS chrome/unified_doc_switcher.zip manifest.json \
background.js \
browser-polyfill.min.js \
browser-polyfill.min.js.map \
content-script.js \
doc-switcher.css \
books.png \
books48.png \
popup
# Add app id info for Firefox
gsed -i '/author/r add-on-id.txt' manifest.json
# Create zip file for Firefox
echo "Packaging for firefox:"
zip -r -FS firefox/unified_doc_switcher.zip manifest.json \
background.js \
browser-polyfill.min.js \
browser-polyfill.min.js.map \
content-script.js \
doc-switcher.css \
books.png \
books48.png \
popup
# Undo manifest change
git checkout manifest.json