aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rwxr-xr-xpackages/taler-wallet-webextension/clean_and_build.sh2
-rwxr-xr-xpackages/taler-wallet-webextension/pack.sh14
-rw-r--r--packages/taler-wallet-webextension/package.json2
3 files changed, 16 insertions, 2 deletions
diff --git a/packages/taler-wallet-webextension/clean_and_build.sh b/packages/taler-wallet-webextension/clean_and_build.sh
index fb53124ef..1c01e3a4a 100755
--- a/packages/taler-wallet-webextension/clean_and_build.sh
+++ b/packages/taler-wallet-webextension/clean_and_build.sh
@@ -15,4 +15,4 @@ pnpm test -- -R dot
echo packing...
rm -rf extension/
-./pack.sh
+./pack.sh dev
diff --git a/packages/taler-wallet-webextension/pack.sh b/packages/taler-wallet-webextension/pack.sh
index 504b5443f..1555e51a5 100755
--- a/packages/taler-wallet-webextension/pack.sh
+++ b/packages/taler-wallet-webextension/pack.sh
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
# This file is in the public domain.
+ENV=$1
set -eu
if [[ ! -e package.json ]]; then
@@ -8,6 +9,8 @@ if [[ ! -e package.json ]]; then
exit 1
fi
+[[ "$ENV" == "prod" || "$ENV" == "dev" ]] || { echo "first argument must be prod or dev"; exit 1; }
+
vers_manifest=$(jq -r '.version' manifest-v2.json)
zipfile="taler-wallet-webextension-${vers_manifest}.zip"
@@ -15,7 +18,13 @@ zipfile="taler-wallet-webextension-${vers_manifest}.zip"
TEMP_DIR=$(mktemp -d)
jq '. | .name = "GNU Taler Wallet" ' manifest-v2.json > $TEMP_DIR/manifest.json
cp -r dist static $TEMP_DIR
+
+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
+
(cd $TEMP_DIR && zip -q -r "$zipfile" dist static manifest.json)
+
mkdir -p extension/v2
mv "$TEMP_DIR/$zipfile" ./extension/v2/
rm -rf $TEMP_DIR
@@ -33,6 +42,11 @@ 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 service_worker.js $TEMP_DIR
+
+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
+
(cd $TEMP_DIR && zip -q -r "$zipfile" dist static manifest.json service_worker.js)
mkdir -p extension/v3
mv "$TEMP_DIR/$zipfile" ./extension/v3/
diff --git a/packages/taler-wallet-webextension/package.json b/packages/taler-wallet-webextension/package.json
index 147ccb359..eaaae5d28 100644
--- a/packages/taler-wallet-webextension/package.json
+++ b/packages/taler-wallet-webextension/package.json
@@ -82,4 +82,4 @@
"pogen": {
"domain": "taler-wallet-webex"
}
-} \ No newline at end of file
+}