-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·24 lines (18 loc) · 795 Bytes
/
build.sh
File metadata and controls
executable file
·24 lines (18 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
set -eu
BROWSER="${1:-}"
if [[ "${BROWSER}" != "chrome" && "${BROWSER}" != "firefox" ]]
then
echo -e '\nProvide "chrome" or "firefox" as a build parameter.\n'
exit 1
fi
BUILD="build/${BROWSER}"
rm -rf "${BUILD}"
mkdir -p "${BUILD}"
cp icon*.png options.html options.css "${BUILD}/"
cp "${BROWSER}-manifest.json" "${BUILD}/manifest.json"
sed "/\/\* include browser-background\.js \*\// r ${BROWSER}-background.js" < background.js > "${BUILD}/background.js"
sed "/\/\* include browser-content\.js \*\// r ${BROWSER}-content.js" < content.js > "${BUILD}/content.js"
sed "/\/\* include browser-options\.js \*\// r ${BROWSER}-options.js" < options.js > "${BUILD}/options.js"
zip -q -j "${BUILD}.zip" "${BUILD}/"*
echo -e "\nExtension ${BUILD}/ zipped as ${BUILD}.zip\n"