don't send dev files into the zip file

This commit is contained in:
Sebastian 2022-09-07 08:49:04 -03:00
parent a37d201aa2
commit 09b085d24b
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1
4 changed files with 17 additions and 3 deletions

View File

@ -75,7 +75,7 @@ anastasis-webui-dev:
webextension: webextension:
pnpm install --frozen-lockfile --filter @gnu-taler/taler-wallet-webextension... pnpm install --frozen-lockfile --filter @gnu-taler/taler-wallet-webextension...
pnpm run --filter @gnu-taler/taler-wallet-webextension... compile 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 .PHONY: webextension-dev
webextension-dev: webextension-dev:

View File

@ -15,4 +15,4 @@ pnpm test -- -R dot
echo packing... echo packing...
rm -rf extension/ rm -rf extension/
./pack.sh ./pack.sh dev

View File

@ -1,6 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This file is in the public domain. # This file is in the public domain.
ENV=$1
set -eu set -eu
if [[ ! -e package.json ]]; then if [[ ! -e package.json ]]; then
@ -8,6 +9,8 @@ if [[ ! -e package.json ]]; then
exit 1 exit 1
fi fi
[[ "$ENV" == "prod" || "$ENV" == "dev" ]] || { echo "first argument must be prod or dev"; exit 1; }
vers_manifest=$(jq -r '.version' manifest-v2.json) vers_manifest=$(jq -r '.version' manifest-v2.json)
zipfile="taler-wallet-webextension-${vers_manifest}.zip" zipfile="taler-wallet-webextension-${vers_manifest}.zip"
@ -15,7 +18,13 @@ zipfile="taler-wallet-webextension-${vers_manifest}.zip"
TEMP_DIR=$(mktemp -d) TEMP_DIR=$(mktemp -d)
jq '. | .name = "GNU Taler Wallet" ' manifest-v2.json > $TEMP_DIR/manifest.json jq '. | .name = "GNU Taler Wallet" ' manifest-v2.json > $TEMP_DIR/manifest.json
cp -r dist static $TEMP_DIR 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) (cd $TEMP_DIR && zip -q -r "$zipfile" dist static manifest.json)
mkdir -p extension/v2 mkdir -p extension/v2
mv "$TEMP_DIR/$zipfile" ./extension/v2/ mv "$TEMP_DIR/$zipfile" ./extension/v2/
rm -rf $TEMP_DIR rm -rf $TEMP_DIR
@ -33,6 +42,11 @@ zipfile="taler-wallet-webextension-${vers_manifest}.zip"
TEMP_DIR=$(mktemp -d) TEMP_DIR=$(mktemp -d)
jq '. | .name = "GNU Taler Wallet" ' manifest-v3.json > $TEMP_DIR/manifest.json jq '. | .name = "GNU Taler Wallet" ' manifest-v3.json > $TEMP_DIR/manifest.json
cp -r dist static service_worker.js $TEMP_DIR 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) (cd $TEMP_DIR && zip -q -r "$zipfile" dist static manifest.json service_worker.js)
mkdir -p extension/v3 mkdir -p extension/v3
mv "$TEMP_DIR/$zipfile" ./extension/v3/ mv "$TEMP_DIR/$zipfile" ./extension/v3/

View File

@ -82,4 +82,4 @@
"pogen": { "pogen": {
"domain": "taler-wallet-webex" "domain": "taler-wallet-webex"
} }
} }