2021-08-15 16:43:36 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# This script assumes a linux environment
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
DES="dist/build/uBlock0.npm"
|
|
|
|
|
2021-08-16 17:54:03 +02:00
|
|
|
TMPDIR="$PWD/tmp"
|
|
|
|
mkdir -p "$TMPDIR/node_modules"
|
2021-08-15 16:43:36 +02:00
|
|
|
|
|
|
|
rm -rf $DES
|
|
|
|
|
|
|
|
./tools/make-nodejs.sh $DES
|
2021-08-16 13:39:09 +02:00
|
|
|
./tools/make-assets.sh $DES
|
2021-08-15 16:43:36 +02:00
|
|
|
|
|
|
|
# Target-specific
|
2021-08-16 13:39:09 +02:00
|
|
|
cp platform/npm/.npmignore $DES/
|
|
|
|
cp platform/npm/*.json $DES/
|
|
|
|
cp platform/npm/.*.json $DES/
|
|
|
|
cp platform/npm/*.js $DES/
|
|
|
|
cp -R platform/npm/tests $DES/
|
2021-08-15 16:43:36 +02:00
|
|
|
|
|
|
|
cd $DES
|
2021-08-16 13:39:09 +02:00
|
|
|
cd tests/data
|
|
|
|
tar xzf bundle.tgz
|
|
|
|
cd -
|
2021-08-15 16:43:36 +02:00
|
|
|
npm run build
|
|
|
|
tarballname=$(npm pack 2> /dev/null)
|
|
|
|
if [ "$1" ]; then
|
|
|
|
echo "*** uBlock0.npm: Creating versioned package..."
|
|
|
|
mv $tarballname ../uBlock0_$1.npm.tgz
|
|
|
|
else
|
|
|
|
echo "*** uBlock0.npm: Creating plain package..."
|
|
|
|
mv $tarballname ../uBlock0.npm.tgz
|
|
|
|
fi
|
2021-08-16 17:54:03 +02:00
|
|
|
ln -sf "$TMPDIR/node_modules"
|
2021-08-16 18:34:54 +02:00
|
|
|
if [ -z "$GITHUB_ACTIONS" ]; then
|
|
|
|
npm install
|
|
|
|
fi
|
2021-08-15 16:43:36 +02:00
|
|
|
cd -
|
|
|
|
|
|
|
|
echo "*** uBlock0.npm: Package done."
|