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.

97 lines
2.6 KiB

#!/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
rm "$dest"
fi
#node $WAPPALYZER_NODE_PATH/node_modules/svg2png/bin/svg2png-cli "$svg" --width=32 --height=32 --output "$dest" || true
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
# WebExtension
echo "Building WebExtension driver..."
webextension_dir=$WAPPALYZER_ROOT/src/drivers/webextension
pushd $webextension_dir > /dev/null
zip -qr $WAPPALYZER_ROOT/build/wappalyzer_webextension.zip .
popd > /dev/null
# Edge
pushd $WAPPALYZER_ROOT/build > /dev/null
mv $webextension_dir/manifest.json $webextension_dir/manifest.webextension.json
mv $webextension_dir/manifest.edge.json $webextension_dir/manifest.json
manifoldjs -l debug -p edgeextension -f edgeextension -m $webextension_dir/manifest.json
mv $webextension_dir/manifest.json $webextension_dir/manifest.edge.json
mv $webextension_dir/manifest.webextension.json $webextension_dir/manifest.json
manifest_dir="Wappalyzer/edgeextension/manifest"
sed -i 's/INSERT-YOUR-PACKAGE-IDENTITY-NAME-HERE/Wappalyzer/' $manifest_dir/appxmanifest.xml
sed -i 's/INSERT-YOUR-PACKAGE-IDENTITY-PUBLISHER-HERE/Wappalyzer/' $manifest_dir/appxmanifest.xml
sed -i 's/INSERT-YOUR-PACKAGE-PROPERTIES-PUBLISHERDISPLAYNAME-HERE/Wappalyzer/' $manifest_dir/appxmanifest.xml
cp $webextension_dir/images/icon_44.png $manifest_dir/Assets/Square44x44Logo.png
cp $webextension_dir/images/icon_150.png $manifest_dir/Assets/Square150x150Logo.png
cp $webextension_dir/images/icon_50.png $manifest_dir/Assets/StoreLogo.png
manifoldjs -l debug -p edgeextension package $manifest_dir
mv Wappalyzer/edgeextension/package/edgeExtension.appx wappalyzer_edge.appx
rm -rf Wappalyzer
popd > /dev/null
echo "Done. Builds have been created in $WAPPALYZER_ROOT/build."