wallet-core/packages/taler-wallet-webextension/pack.sh

45 lines
1.3 KiB
Bash
Raw Normal View History

2020-08-10 18:49:23 +02:00
#!/usr/bin/env bash
# This file is in the public domain.
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
2021-12-20 05:38:20 +01:00
vers_manifest=$(jq -r '.version' manifest-v2.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
TEMP_DIR=$(mktemp -d)
2021-12-20 05:38:20 +01:00
jq '. | .name = "GNU Taler Wallet" ' manifest-v2.json > $TEMP_DIR/manifest.json
cp -r dist static $TEMP_DIR
2022-03-24 20:02:38 +01:00
(cd $TEMP_DIR && zip -q -r "$zipfile" dist static manifest.json)
2021-12-20 05:38:20 +01:00
mkdir -p extension/v2
mv "$TEMP_DIR/$zipfile" ./extension/v2/
rm -rf $TEMP_DIR
# 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"
cp -rf src extension/v2/unpacked
2021-12-20 05:38:20 +01:00
vers_manifest=$(jq -r '.version' manifest-v3.json)
zipfile="taler-wallet-webextension-${vers_manifest}.zip"
TEMP_DIR=$(mktemp -d)
jq '. | .name = "GNU Taler Wallet" ' manifest-v3.json > $TEMP_DIR/manifest.json
cp -r dist static $TEMP_DIR
2022-03-24 20:02:38 +01:00
(cd $TEMP_DIR && zip -q -r "$zipfile" dist static manifest.json)
2021-12-20 05:38:20 +01:00
mkdir -p extension/v3
mv "$TEMP_DIR/$zipfile" ./extension/v3/
rm -rf $TEMP_DIR
# 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"