2020-08-10 18:49:23 +02:00
|
|
|
#!/usr/bin/env bash
|
2021-06-16 21:19:27 +02:00
|
|
|
# This file is in the public domain.
|
2020-08-10 18:49:23 +02:00
|
|
|
|
2022-09-07 13:49:04 +02:00
|
|
|
ENV=$1
|
2020-08-10 18:49:23 +02:00
|
|
|
set -eu
|
|
|
|
|
|
|
|
if [[ ! -e package.json ]]; then
|
|
|
|
echo "Please run this from the root of the repo.">&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-09-07 13:49:04 +02:00
|
|
|
[[ "$ENV" == "prod" || "$ENV" == "dev" ]] || { echo "first argument must be prod or dev"; exit 1; }
|
|
|
|
|
2022-09-07 15:55:54 +02:00
|
|
|
vers_manifest=$(jq -r '.version' manifest-common.json)
|
2020-08-10 18:49:23 +02:00
|
|
|
|
2020-11-25 16:04:07 +01:00
|
|
|
zipfile="taler-wallet-webextension-${vers_manifest}.zip"
|
2020-08-10 18:49:23 +02:00
|
|
|
|
2021-06-16 21:17:00 +02:00
|
|
|
TEMP_DIR=$(mktemp -d)
|
2022-09-07 15:55:54 +02:00
|
|
|
jq -s 'add | .name = "GNU Taler Wallet" ' manifest-common.json manifest-v2.json > $TEMP_DIR/manifest.json
|
2021-06-16 21:17:00 +02:00
|
|
|
cp -r dist static $TEMP_DIR
|
2022-09-07 13:49:04 +02:00
|
|
|
|
|
|
|
find $TEMP_DIR/dist \( -name "test.*" -o -name "*.test.*" -o -name "stories.*" -o -name "*.dev.*" \) -delete
|
|
|
|
[[ "$ENV" == "prod" ]] && find $TEMP_DIR/dist \( -name "*.map" \) -delete
|
|
|
|
find $TEMP_DIR/dist -type d -empty -delete
|
|
|
|
|
2022-03-24 20:02:38 +01:00
|
|
|
(cd $TEMP_DIR && zip -q -r "$zipfile" dist static manifest.json)
|
2022-09-07 13:49:04 +02:00
|
|
|
|
2021-12-20 05:38:20 +01:00
|
|
|
mkdir -p extension/v2
|
|
|
|
mv "$TEMP_DIR/$zipfile" ./extension/v2/
|
2021-06-16 21:17:00 +02:00
|
|
|
rm -rf $TEMP_DIR
|
2022-03-08 23:18:14 +01:00
|
|
|
# also provide unpacked version
|
|
|
|
rm -rf extension/v2/unpacked
|
|
|
|
mkdir -p extension/v2/unpacked
|
2022-03-24 20:02:38 +01:00
|
|
|
(cd extension/v2/unpacked && unzip -q ../$zipfile)
|
2021-12-20 05:38:20 +01:00
|
|
|
echo "Packed webextension: extension/v2/$zipfile"
|
2022-03-15 16:23:41 +01:00
|
|
|
cp -rf src extension/v2/unpacked
|
2021-12-20 05:38:20 +01:00
|
|
|
|
|
|
|
zipfile="taler-wallet-webextension-${vers_manifest}.zip"
|
|
|
|
|
|
|
|
TEMP_DIR=$(mktemp -d)
|
2022-09-07 15:55:54 +02:00
|
|
|
jq -s 'add | .name = "GNU Taler Wallet" ' manifest-common.json manifest-v3.json > $TEMP_DIR/manifest.json
|
2022-05-06 22:29:42 +02:00
|
|
|
cp -r dist static service_worker.js $TEMP_DIR
|
2022-09-07 13:49:04 +02:00
|
|
|
|
|
|
|
find $TEMP_DIR/dist \( -name "test.*" -o -name "*.test.*" -o -name "stories.*" -o -name "*.dev.*" \) -delete
|
|
|
|
[[ "$ENV" == "prod" ]] && find $TEMP_DIR/dist \( -name "*.map" \) -delete
|
|
|
|
find $TEMP_DIR/dist -type d -empty -delete
|
|
|
|
|
2022-05-06 22:29:42 +02:00
|
|
|
(cd $TEMP_DIR && zip -q -r "$zipfile" dist static manifest.json service_worker.js)
|
2021-12-20 05:38:20 +01:00
|
|
|
mkdir -p extension/v3
|
|
|
|
mv "$TEMP_DIR/$zipfile" ./extension/v3/
|
|
|
|
rm -rf $TEMP_DIR
|
2022-03-08 23:18:14 +01:00
|
|
|
# also provide unpacked version
|
|
|
|
rm -rf extension/v3/unpacked
|
|
|
|
mkdir -p extension/v3/unpacked
|
2022-03-24 20:02:38 +01:00
|
|
|
(cd extension/v3/unpacked && unzip -q ../$zipfile)
|
2021-12-20 05:38:20 +01:00
|
|
|
echo "Packed webextension: extension/v3/$zipfile"
|