#!/bin/bash if [ -z $WAPPALYZER_ROOT ] then echo "\$WAPPALYZER_ROOT not set" exit 1 fi if [ -z $WAPPALYZER_NODE_PATH ] then echo "\$WAPPALYZER_NODE_PATH not set" exit 1 fi set -eu wappalyzer validate echo "Prettifying apps.json..." node $WAPPALYZER_NODE_PATH/node_modules/jsonlint/lib/cli.js -ist $'\t' $WAPPALYZER_ROOT/src/apps.json echo "Compressing PNG and SVG icons..." node $WAPPALYZER_NODE_PATH/node_modules/imagemin-cli/cli.js $WAPPALYZER_ROOT/src/icons/* --out-dir $WAPPALYZER_ROOT/src/icons 2>&1 > /dev/null echo "Converting SVG icons to PNG..." OIFS="$IFS" IFS=$'\n' for svg in $(find $WAPPALYZER_ROOT/src/icons -type f -name "*.svg") do echo " Converting $(basename "$svg")..." dest="$WAPPALYZER_ROOT/src/icons/converted/$(basename "$svg").png" if [[ ! -f "$dest" ]]; then node $WAPPALYZER_NODE_PATH/node_modules/svg2png/bin/svg2png-cli "$svg" --width=32 --height=32 --output "$dest" || true fi done IFS="$OIFS" echo "Compressing converted PNG icons..." node $WAPPALYZER_NODE_PATH/node_modules/imagemin-cli/cli.js $WAPPALYZER_ROOT/src/icons/converted/* $WAPPALYZER_ROOT/src/icons/converted wappalyzer links # Mozilla Firefox echo "Building Firefox driver..." pushd $WAPPALYZER_ROOT/src/drivers/firefox > /dev/null node $WAPPALYZER_NODE_PATH/node_modules/jpm/bin/jpm xpi && mv *.xpi $WAPPALYZER_ROOT/build/wappalyzer_firefox.xpi popd > /dev/null # Google Chrome echo "Building Chrome driver..." pushd $WAPPALYZER_ROOT/src/drivers/chrome > /dev/null zip -qr $WAPPALYZER_ROOT/build/wappalyzer_chrome.zip . # Google Chrome echo "Building WebExtension drivers..." pushd $WAPPALYZER_ROOT/src/drivers/webextension > /dev/null zip -qr $WAPPALYZER_ROOT/build/wappalyzer_webextension.firefox.zip . -x manifest.chrome-opera.json manifest.edge.json printf "@ manifest.firefox.json\n@=manifest.json\n" | zipnote -w $WAPPALYZER_ROOT/build/wappalyzer_webextension.firefox.zip zip -qr $WAPPALYZER_ROOT/build/wappalyzer_webextension.chrome-opera.zip . -x manifest.firefox.json manifest.edge.json printf "@ manifest.chrome-opera.json\n@=manifest.json\n" | zipnote -w $WAPPALYZER_ROOT/build/wappalyzer_webextension.chrome-opera.zip zip -qr $WAPPALYZER_ROOT/build/wappalyzer_webextension.edge.zip . -x manifest.chrome-opera.json manifest.firefox.json printf "@ manifest.edge.json\n@=manifest.json\n" | zipnote -w $WAPPALYZER_ROOT/build/wappalyzer_webextension.edge.zip popd > /dev/null echo "Done. Builds have been created in $WAPPALYZER_ROOT/build."