mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
node -> v8.9.4 yarn -> 1.5.1 nvm -> 0.33.8 Also updates a test in timerender.js which depends on time provided by node which is now changed in newer release. Some changes have been made in circeci script, we just create ~/.config directory and chown it to circleci user so installing new version of yarn does not cause any ci failure on circleci during provision.
46 lines
1.3 KiB
Bash
Executable File
46 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
ZULIP_PATH="$(dirname "$0")/../.."
|
|
ZULIP_SRV="/srv"
|
|
if [ "$TRAVIS" ] ; then
|
|
ZULIP_SRV="/home/travis"
|
|
fi
|
|
YARN_BIN="$ZULIP_SRV/zulip-yarn/bin/yarn"
|
|
node_version=8.11.1
|
|
yarn_version=1.5.1
|
|
|
|
current_node_version="none"
|
|
if hash node 2>/dev/null; then
|
|
current_node_version="$(node --version)"
|
|
fi
|
|
|
|
if [ "$($YARN_BIN --version 2>/dev/null)" = "$yarn_version" ] && [ "$current_node_version" = "v$node_version" ]; then
|
|
echo "Node version $node_version and yarn version $yarn_version are already installed."
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$current_node_version" != "v$node_version" ]; then
|
|
export NVM_DIR=/usr/local/nvm
|
|
if ! [ -e "$NVM_DIR/nvm.sh" ]; then
|
|
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
|
|
fi
|
|
|
|
source "$NVM_DIR/nvm.sh"
|
|
nvm install "$node_version" && nvm alias default "$node_version"
|
|
export NODE_BIN="$(nvm which default)"
|
|
|
|
# Fix messed-up uid=500 and group write bits produced by nvm
|
|
n=$(which node)
|
|
n=${n%/bin/node}
|
|
chown -R root:root "$n"
|
|
chmod -R go-w "$n"
|
|
|
|
# Install node wrapper to /usr/local/bin
|
|
cp "$ZULIP_PATH/scripts/setup/node-wrapper" /usr/local/bin/node
|
|
sed -i "s|NODE_PATH|$NODE_BIN|" /usr/local/bin/node
|
|
fi
|
|
|
|
# Install yarn if not installed
|
|
bash "$ZULIP_PATH/scripts/lib/third/install-yarn.sh" "$ZULIP_SRV" --version "$yarn_version"
|