Skip to content

Commit

Permalink
Improve speed of JS package version checking
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanv committed Feb 27, 2017
1 parent e1c8115 commit 61d255f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .travis/travis_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions tools/check_js_deps.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 61d255f

Please sign in to comment.