From 61d255f2e27c801c655b2b38d6b1c98f109c2fa9 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Mon, 27 Feb 2017 10:06:13 -0800 Subject: [PATCH] Improve speed of JS package version checking --- .travis/travis_install.sh | 3 +++ Makefile | 12 ++++++++---- README.md | 2 ++ tools/check_js_deps.sh | 19 +++++++++++++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) create mode 100755 tools/check_js_deps.sh diff --git a/.travis/travis_install.sh b/.travis/travis_install.sh index 31648b2..c8644fe 100755 --- a/.travis/travis_install.sh +++ b/.travis/travis_install.sh @@ -22,6 +22,9 @@ npm -g install npm@latest npm --version node --version make dependencies +echo "The following report indicates Javascript packages that are eligible" +echo " for updates:" +make check-js-updates section_end "install.cesium_web.requirements" diff --git a/Makefile b/Makefile index f7b6999..ef24450 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ dev_dependencies: dependencies: @./tools/install_deps.py requirements.txt - npm update + @./tools/check_js_deps.sh db_init: ./tools/db_create.sh @@ -66,6 +66,10 @@ docker-images: docker build -t cesium/web . && docker push cesium/web cd docker/postgres && docker build -t cesium/postgres . && docker push cesium/postgres -npm-update: - npm install -g npm-check-updates - ncu +# Call this target to see which Javascript dependencies are not up to date +check-js-updates: + @if [[ ! -x ./node_modules/.bin/npm-check-updates ]]; then \ + npm install npm-check-updates > /dev/null 2>&1; \ + fi + @ncu + diff --git a/README.md b/README.md index 8af60a4..2e5eaf3 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,8 @@ Debugging: - Run `make log` to watch log output - Run `make debug` to start webserver in debug mode - Run `make attach` to attach to output of webserver, e.g. for use with `pdb.set_trace()` +- Run `make check-js-updates` to see which Javascript packages are eligible + for an upgrade. ## Standards diff --git a/tools/check_js_deps.sh b/tools/check_js_deps.sh new file mode 100755 index 0000000..d67352f --- /dev/null +++ b/tools/check_js_deps.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e + +CHECKER='./node_modules/.bin/check-dependencies' + +if [[ ! -x ${CHECKER} ]]; then + npm install check-dependencies > /dev/null 2>&1 +fi + +# We suppress output for the next command because, annoyingly, it reports +# that a dependency is unsatisfied even if the --install flag is specified, +# and that package has been successfully installed +${CHECKER} --install > /dev/null 2>&1 + +# Print report, if any unsatisfied dependencies remain +if ${CHECKER}; then + echo "✓ All Javascript dependencies satisfied." +fi