#!/usr/bin/sh

NAME=$(grep "name" package.json | grep -oP '(?<=: ")[^"]+')
VERSION=$(grep "version" package.json | grep -oP '(?<=: ")[^"]+')
BROWSERS=("chrome" "firefox")
SCRIPT_DIR=$(dirname "$(realpath "$0")")

for BROWSER in "${BROWSERS[@]}"; do
	FILENAME="$NAME-$BROWSER@v$VERSION.zip"
	pnpm build:$BROWSER
	python -m zipfile --create "$SCRIPT_DIR/releases/$FILENAME" "$SCRIPT_DIR/dist"
	python -m zipfile --test "$SCRIPT_DIR/releases/$FILENAME"
done
