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.

114 lines
3.0 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 {} \;
echo "Prettifying apps.json..."
jsonlint-cli -ist $'\t' 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
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 manifest.edge.json \
-x \*.log \
-x \*.lock \
-x \*.gitignore \
-x \*.gitkeep \
-x \*.js.map \
-x \*.min.js \
-x \*.yarn-integrity \
-x \*package.json \
-x \*LICENSE \
-x \*README.md
8 years ago
popd > /dev/null
# Edge
echo "Building Edge application..."
8 years ago
pushd build > /dev/null
webextension_dir="../$webextension_dir"
manifest_dir="Wappalyzer/edgeextension/manifest"
8 years ago
mv $webextension_dir/manifest.json $webextension_dir/manifest.webextension.json
mv $webextension_dir/manifest.edge.json $webextension_dir/manifest.json
7 years ago
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$version\"/" $webextension_dir/manifest.json
8 years ago
manifoldjs -l debug -p edgeextension -f edgeextension -m $webextension_dir/manifest.json
# Replace symlinks with actual files
rm $manifest_dir/Extension/images/icons
cp ../src/apps.json $manifest_dir/Extension
cp ../src/wappalyzer.js $manifest_dir/Extension/js
cp -r ../src/icons $manifest_dir/Extension/images
8 years ago
mv $webextension_dir/manifest.json $webextension_dir/manifest.edge.json
mv $webextension_dir/manifest.webextension.json $webextension_dir/manifest.json
sed -i 's/INSERT-YOUR-PACKAGE-IDENTITY-NAME-HERE/1591Wappalyzer.Wappalyzer/' $manifest_dir/appxmanifest.xml
sed -i 's/INSERT-YOUR-PACKAGE-IDENTITY-PUBLISHER-HERE/D240C22F-A6C1-45DF-BF7B-4C835064DF51/' $manifest_dir/appxmanifest.xml
8 years ago
sed -i 's/INSERT-YOUR-PACKAGE-PROPERTIES-PUBLISHERDISPLAYNAME-HERE/Wappalyzer/' $manifest_dir/appxmanifest.xml
sed -i 's/Version="0.\([^"]\+\)/Version="\1.0/' $manifest_dir/appxmanifest.xml
8 years ago
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
7 years ago
echo "Done (v$version)."