From 7bdd0f2f09610b4f3e3f71d7a4432e65df84cbfa Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 18 Jun 2021 04:28:41 -0400 Subject: [PATCH] bin/updatePlugins.sh: Many refinements * cd to top-level Etherpad directory is now more robust. * Only attempt to update packages whose names begin with `ep_`. * Don't create `package-lock.json`. * Improve logging. * Improve error handling. --- src/bin/updatePlugins.sh | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/bin/updatePlugins.sh b/src/bin/updatePlugins.sh index ce7a46f6b..586ba1623 100755 --- a/src/bin/updatePlugins.sh +++ b/src/bin/updatePlugins.sh @@ -1,20 +1,11 @@ #!/bin/sh - -#Move to the folder where ep-lite is installed -cd $(dirname $0) - -#Was this script started in the bin folder? if yes move out -if [ -d "../bin" ]; then - cd "../" -fi - -# npm outdated --depth=0 | grep -v "^Package" | awk '{print $1}' | xargs npm install $1 --save-dev -OUTDATED=$(npm outdated --depth=0 | grep -v "^Package" | awk '{print $1}') -# echo $OUTDATED -if test -n "$OUTDATED"; then - echo "Plugins require update, doing this now..." - echo "Updating $OUTDATED" - npm install $OUTDATED --save-dev -else - echo "Plugins are all up to date" -fi +set -e +mydir=$(cd "${0%/*}" && pwd -P) || exit 1 +cd "${mydir}"/../.. +OUTDATED=$(npm outdated --depth=0 | awk '{print $1}' | grep '^ep_') || { + echo "All plugins are up-to-date" + exit 0 +} +set -- ${OUTDATED} +echo "Updating plugins: $*" +exec npm install --no-save "$@"