You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

74 lines
1.5 KiB

#!/bin/bash
cd "$(dirname $0)/.."
7 years ago
version="$2"
if [[ -z "$version" ]]; then
current=$(grep '"version":' src/drivers/webextension/manifest.json | sed 's/^.*"version": "\(.*\)".*$/\1/')
echo "No version specified. Current version is $current."
exit 1;
fi
8 years ago
set -eu
./bin/validate
7 years ago
echo "Deleting junk files..."
find . -name ".DS_Store" -exec rm {} \;
7 years ago
echo "Prettifying apps.json..."
7 years ago
sed -e 's/\\\\/{{ESCAPE}}/g' src/apps.json | jsonlint-cli -ps | sed -e 's/{{ESCAPE}}/\\\\/g' > /tmp/apps.json && cat /tmp/apps.json > src/apps.json
echo "Converting SVG icons to PNG..."
7 years ago
svg2png-many -i src/icons/ -o src/icons/converted/ --width=32 --height=32
echo "Compressing PNG icons..."
set +e
optipng -quiet "src/icons/*.png"
optipng -quiet "src/icons/converted/*.png"
set -e
7 years ago
# NPM
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$version\"/" src/drivers/npm/package.json
# WebExtension
echo "Building WebExtension..."
webextension_dir=src/drivers/webextension
8 years ago
pushd $webextension_dir > /dev/null
sed -i "/sourceMappingURL/d" node_modules/webextension-polyfill/dist/browser-polyfill.js
7 years ago
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$version\"/" manifest.json
zip -qr ../../../build/wappalyzer_webextension.zip . \
-x images/icon_44.png \
-x images/icon_50.png \
-x images/icon_150.png \
-x js/ms_\*.js \
-x \*.log \
-x \*.lock \
-x \*.gitignore \
-x \*.gitkeep \
-x \*.js.map \
-x \*.min.js \
6 years ago
-x \*.spec.js \
-x \*.yarn-integrity \
-x \*package.json \
-x \*LICENSE \
-x \*README.md
8 years ago
popd > /dev/null
7 years ago
echo "Done (v$version)."