forked from spinnaker/deck
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·26 lines (20 loc) · 752 Bytes
/
start.sh
File metadata and controls
executable file
·26 lines (20 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
CURRENT_VERSION=$(node -v)
# Process engines format like { "node": ">=7.0.0" }
DESIRED_VERSION=$(node -e "console.log(require('./package.json').engines.node.replace(/[^0-9.]/g, ''))");
if [ $CURRENT_VERSION != "v$DESIRED_VERSION" ]; then
if [ -f $HOME/.nvm/nvm.sh ]; then
echo "Node is currently $CURRENT_VERSION. Activating $DESIRED_VERSION using nvm..."
. $HOME/.nvm/nvm.sh
echo "Using $DESIRED_VERSION...";
nvm use $DESIRED_VERSION
if [ $? != 0 ]; then
echo "Installing node $DESIRED_VERSION..."
nvm install $DESIRED_VERSION
fi
else
echo "WARNING: could not update to node $DESIRED_VERSION, nvm not found..."
fi
fi
echo "Launching deck using node $(node -v)..."
npm run start-dev-server