2022-09-06 11:47:52 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# This script assumes a linux environment
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
echo "*** uBlock0.mv3: Creating extension"
|
|
|
|
|
|
|
|
DES="dist/build/uBlock0.mv3"
|
2022-09-07 08:15:36 -06:00
|
|
|
|
|
|
|
if [ "$1" != "quick" ]; then
|
|
|
|
rm -rf $DES
|
|
|
|
fi
|
|
|
|
|
2022-09-06 11:47:52 -06:00
|
|
|
mkdir -p $DES
|
|
|
|
cd $DES
|
|
|
|
DES=$(pwd)
|
|
|
|
cd - > /dev/null
|
|
|
|
|
2022-09-07 08:15:36 -06:00
|
|
|
mkdir -p $DES/css/fonts
|
|
|
|
mkdir -p $DES/js
|
|
|
|
mkdir -p $DES/img
|
2022-09-06 11:47:52 -06:00
|
|
|
|
|
|
|
echo "*** uBlock0.mv3: Copying common files"
|
2022-09-07 08:15:36 -06:00
|
|
|
cp -R src/css/fonts/* $DES/css/fonts/
|
|
|
|
cp src/css/themes/default.css $DES/css/
|
|
|
|
cp src/css/common.css $DES/css/
|
|
|
|
cp src/css/fa-icons.css $DES/css/
|
|
|
|
cp src/js/fa-icons.js $DES/js/
|
|
|
|
|
2022-09-06 11:47:52 -06:00
|
|
|
cp LICENSE.txt $DES/
|
|
|
|
|
2022-09-07 08:15:36 -06:00
|
|
|
echo "*** uBlock0.mv3: Copying mv3-specific files"
|
|
|
|
cp platform/mv3/extension/*.html $DES/
|
|
|
|
cp platform/mv3/extension/css/* $DES/css/
|
|
|
|
cp platform/mv3/extension/js/* $DES/js/
|
|
|
|
cp platform/mv3/extension/img/* $DES/img/
|
|
|
|
|
|
|
|
if [ "$1" != "quick" ]; then
|
|
|
|
echo "*** uBlock0.mv3: Generating rulesets"
|
|
|
|
TMPDIR=$(mktemp -d)
|
|
|
|
mkdir -p $TMPDIR
|
|
|
|
cp platform/mv3/extension/manifest.json $DES/
|
|
|
|
./tools/make-nodejs.sh $TMPDIR
|
|
|
|
cp platform/mv3/package.json $TMPDIR/
|
|
|
|
cp platform/mv3/*.js $TMPDIR/
|
|
|
|
cd $TMPDIR
|
|
|
|
node --no-warnings make-rulesets.js output=$DES quick=$QUICK
|
|
|
|
cd - > /dev/null
|
|
|
|
rm -rf $TMPDIR
|
|
|
|
fi
|
2022-09-06 11:47:52 -06:00
|
|
|
|
|
|
|
echo "*** uBlock0.mv3: extension ready"
|
|
|
|
echo "Extension location: $DES/"
|
|
|
|
|
2022-09-07 08:23:40 -06:00
|
|
|
if [ "$1" = "all" ]; then
|
|
|
|
echo "*** uBlock0.mv3: Creating webstore package..."
|
|
|
|
PACKAGENAME=uBlock0_$(jq -r .version $DES/manifest.json).mv3.zip
|
|
|
|
TMPDIR=$(mktemp -d)
|
|
|
|
mkdir -p $TMPDIR
|
|
|
|
cp -R $DES/* $TMPDIR/
|
|
|
|
cd $TMPDIR > /dev/null
|
|
|
|
rm log.txt
|
|
|
|
zip $PACKAGENAME -qr ./*
|
|
|
|
cp $PACKAGENAME $(dirname $DES/)/
|
|
|
|
cd - > /dev/null
|
|
|
|
rm -rf $TMPDIR
|
|
|
|
echo "Package location: $(pwd)/$PACKAGENAME"
|
|
|
|
fi
|