From 30e46ba64a2b88ecc4b8452f2a1e691133940835 Mon Sep 17 00:00:00 2001 From: Manish Jethani Date: Mon, 16 Aug 2021 21:24:03 +0530 Subject: [PATCH] Use symlink for node_modules (#3830) --- Makefile | 2 +- tools/make-npm.sh | 16 +++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 502c6e815..a5860eea8 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/tools/make-npm.sh b/tools/make-npm.sh index ee34a5d78..207ffb783 100755 --- a/tools/make-npm.sh +++ b/tools/make-npm.sh @@ -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."