Use symlink for node_modules (#3830)

This commit is contained in:
Manish Jethani 2021-08-16 21:24:03 +05:30 committed by GitHub
parent a2a8ef7e85
commit 30e46ba64a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 14 deletions

View File

@ -51,7 +51,7 @@ update-submodules:
tools/update-submodules.sh
clean:
rm -rf dist/build
rm -rf dist/build tmp/node_modules
# Not real targets, just convenient for auto-completion at shell prompt

View File

@ -6,14 +6,8 @@ set -e
DES="dist/build/uBlock0.npm"
TMPDIR=tmp
mkdir -p $TMPDIR
# Save existing npm dependencies if present so that we do not have to fetch
# them all again
if [ -d "$DES/node_modules" ]; then
mv "$DES/node_modules" "$TMPDIR/node_modules"
fi
TMPDIR="$PWD/tmp"
mkdir -p "$TMPDIR/node_modules"
rm -rf $DES
@ -40,11 +34,7 @@ else
echo "*** uBlock0.npm: Creating plain package..."
mv $tarballname ../uBlock0.npm.tgz
fi
ln -sf "$TMPDIR/node_modules"
cd -
# Restore saved npm dependencies
if [ -d "$TMPDIR/node_modules" ]; then
mv "$TMPDIR/node_modules" "$DES/node_modules"
fi
echo "*** uBlock0.npm: Package done."