Save/restore node_modules dependencies if present

To avoid hacing to fetch them all over again each time we
launch the test suite.
This commit is contained in:
Raymond Hill 2021-08-14 11:27:07 -04:00
parent fd9888f85e
commit 6c4472ce7f
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 13 additions and 0 deletions

View File

@ -6,6 +6,13 @@ set -e
DES=dist/build/uBlock0.nodejs
# Save existing npm dependencies if present so that we do not have to fetch
# them all again
if [ -d "$DES/node_modules" ]; then
TMPDIR=`mktemp -d`
mv "$DES/node_modules" "$TMPDIR/node_modules"
fi
rm -rf $DES
mkdir -p $DES/js
@ -72,4 +79,10 @@ else
fi
cd -
# Restore saved npm dependencies
if [ -n "$TMPDIR" ]; then
mv "$TMPDIR/node_modules" "$DES/node_modules"
rmdir "$TMPDIR"
fi
echo "*** uBlock0.nodejs: Package done."