mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
provision: Use a more efficient approach for getting yarn version.
Since yarn has a package.json conveniently available, we can parse that with jq, saving the expensive operation of starting up yarn. This saves ~300ms in a no-op provision.
This commit is contained in:
@@ -163,7 +163,7 @@ fi
|
|||||||
|
|
||||||
apt-get -y dist-upgrade "${APT_OPTIONS[@]}"
|
apt-get -y dist-upgrade "${APT_OPTIONS[@]}"
|
||||||
if ! apt-get install -y \
|
if ! apt-get install -y \
|
||||||
puppet git curl wget \
|
puppet git curl wget jq \
|
||||||
python python3 python-six python3-six crudini \
|
python python3 python-six python3-six crudini \
|
||||||
"${ADDITIONAL_PACKAGES[@]}"; then
|
"${ADDITIONAL_PACKAGES[@]}"; then
|
||||||
set +x
|
set +x
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ ZULIP_SRV="/srv"
|
|||||||
if [ "$TRAVIS" ] ; then
|
if [ "$TRAVIS" ] ; then
|
||||||
ZULIP_SRV="/home/travis"
|
ZULIP_SRV="/home/travis"
|
||||||
fi
|
fi
|
||||||
YARN_BIN="$ZULIP_SRV/zulip-yarn/bin/yarn"
|
YARN_PACKAGE_JSON="$ZULIP_SRV/zulip-yarn/package.json"
|
||||||
node_version=8.11.1
|
node_version=8.11.1
|
||||||
yarn_version=1.7.0
|
yarn_version=1.7.0
|
||||||
|
|
||||||
@@ -20,7 +20,12 @@ if node_wrapper_path="$(command -v node)"; then
|
|||||||
current_node_version="$(node --version)"
|
current_node_version="$(node --version)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$($YARN_BIN --version 2>/dev/null)" = "$yarn_version" ] && [ "$current_node_version" = "v$node_version" ] && [ -L "$node_wrapper_path" ]; then
|
current_yarn_version="none"
|
||||||
|
if [ -e "$YARN_PACKAGE_JSON" ]; then
|
||||||
|
current_yarn_version=$(jq -r '.version' "$YARN_PACKAGE_JSON")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$current_yarn_version" = "$yarn_version" ] && [ "$current_node_version" = "v$node_version" ] && [ -L "$node_wrapper_path" ]; then
|
||||||
echo "Node version $node_version and yarn version $yarn_version are already installed."
|
echo "Node version $node_version and yarn version $yarn_version are already installed."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -37,6 +37,12 @@ VENV_DEPENDENCIES = [
|
|||||||
"libxslt1-dev", # Used for installing talon
|
"libxslt1-dev", # Used for installing talon
|
||||||
"libpq-dev", # Needed by psycopg2
|
"libpq-dev", # Needed by psycopg2
|
||||||
"libssl-dev", # Needed to build pycurl and other libraries
|
"libssl-dev", # Needed to build pycurl and other libraries
|
||||||
|
|
||||||
|
# This is technically a node dependency, but we add it here
|
||||||
|
# because we don't have another place that we install apt packages
|
||||||
|
# on upgrade of a production server, and it's not worth adding
|
||||||
|
# another call to `apt install` for.
|
||||||
|
"jq", # Used by scripts/lib/install-node to check yarn version
|
||||||
]
|
]
|
||||||
|
|
||||||
codename = parse_lsb_release()["DISTRIB_CODENAME"]
|
codename = parse_lsb_release()["DISTRIB_CODENAME"]
|
||||||
|
|||||||
Reference in New Issue
Block a user