aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-09-07 08:49:04 -0300
committerSebastian <sebasjm@gmail.com>2022-09-07 08:49:04 -0300
commit09b085d24b2a8d4e7723afe82dfd46dd9d36a71a (patch)
tree0718f579fa19a73c5c616290ba4f24968fbe4345
parenta37d201aa26fedc6671882ae0d1e7ac7f748f917 (diff)
don't send dev files into the zip file
-rw-r--r--build-system/Makefile2
-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
4 files changed, 17 insertions, 3 deletions
diff --git a/build-system/Makefile b/build-system/Makefile
index 5899c7a4c..65e0e9235 100644
--- a/build-system/Makefile
+++ b/build-system/Makefile
@@ -75,7 +75,7 @@ anastasis-webui-dev:
webextension:
pnpm install --frozen-lockfile --filter @gnu-taler/taler-wallet-webextension...
pnpm run --filter @gnu-taler/taler-wallet-webextension... compile
- cd ./packages/taler-wallet-webextension/ && ./pack.sh
+ cd ./packages/taler-wallet-webextension/ && ./pack.sh prod
.PHONY: webextension-dev
webextension-dev:
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
+}