aboutsummaryrefslogtreecommitdiffhomepage
path: root/build.bash
blob: 4dfc387cc97edb8b484f9ed82599480dd282743f (plain)
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
#!/usr/bin/env bash
set -euo pipefail

dist="dist/"
BROWSER=$1

rm -rf "$dist"
mkdir "$dist"
find src/ -not -name "*.js" -exec cp '{}' "$dist" \;
cp README.md LICENSE.txt "$dist"
npm run build

echo

rm -f archiveror.zip archiveror-source.zip

if [[ $BROWSER = 'chromium' ]]; then
    cd "$dist"
    # the "applications" key is only supported on Firefox
    jq 'del(.applications)' manifest.json > mani.json
    rm manifest.json
    mv mani.json manifest.json
    cd -
elif [[ $BROWSER = 'firefox' ]]; then
    echo -e "\nMaking archiveror-source.zip for Firefox..."
    zip -r archiveror-source.zip src/ build.bash package.json package-lock.json webpack.config.js README.md LICENSE.txt
else
    echo "Invalid browser choice!"
    exit 1
fi

cd "$dist"
echo -e "\nMaking archiveror.zip..."
zip archiveror.zip *.js *.html *.css *.png manifest.json README.md LICENSE.txt
cd -
mv "$dist"/archiveror.zip ./