Skip to content

Commit

Permalink
drun-node defaults to node:latest if package.json is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbochi committed Aug 12, 2016
1 parent 2e185f1 commit 7c0c43c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drun-node
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
set -e
set -o pipefail

if hash jq 2> /dev/null; then
if [ ! -f package.json ]; then
NODE_VERSION='latest'
elif hash jq 2> /dev/null; then
NODE_VERSION=$(jq -r -e '.engines.node // "latest"' package.json)
else
NODE_VERSION=$(python -c "import json;print json.load(open('package.json'))['engines']['node']" 2> /dev/null || echo latest)
Expand Down

0 comments on commit 7c0c43c

Please sign in to comment.