mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
install-node: Upgrade Node.js to 18.14.0; manage Yarn with Corepack.
Corepack manages multiple per-project version of Yarn and PNPM, which means we have to maintain less installation code, and could help us switch away from Yarn 1 without making the system unusable for development of other Yarn 1 projects. https://nodejs.org/api/corepack.html The Unicode spaces in the timerender test resulted from an ICU upgrade: https://github.com/nodejs/node/pull/45068. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
70ac144d57
commit
ec58b6790d
@@ -1,23 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
version=18.12.1
|
||||
version=18.14.0
|
||||
arch="$(uname -m)"
|
||||
|
||||
case $arch in
|
||||
x86_64)
|
||||
tarball="node-v$version-linux-x64.tar.xz"
|
||||
sha256=4481a34bf32ddb9a9ff9540338539401320e8c3628af39929b4211ea3552a19e
|
||||
sha256=1ccec74b6240fce8754813e31fdbc93ad520df2e814729cea29efe9075e48350
|
||||
;;
|
||||
|
||||
aarch64)
|
||||
tarball="node-v$version-linux-arm64.tar.xz"
|
||||
sha256=3904869935b7ecc51130b4b86486d2356539a174d11c9181180cab649f32cd2a
|
||||
sha256=30ef375f0b8006759c0e08bee9d4b74915b95abfa924006c289d2d474a8b152e
|
||||
;;
|
||||
esac
|
||||
|
||||
check_version() {
|
||||
out="$(node --version)" && [ "$out" = "v$version" ]
|
||||
out="$(node --version)" && [ "$out" = "v$version" ] \
|
||||
&& [ /usr/local/bin/yarn -ef /srv/zulip-node/lib/node_modules/corepack/dist/yarn.js ]
|
||||
}
|
||||
|
||||
if ! check_version 2>/dev/null; then
|
||||
@@ -33,7 +34,11 @@ if ! check_version 2>/dev/null; then
|
||||
rm -rf /srv/zulip-node
|
||||
mkdir -p /srv/zulip-node
|
||||
tar -xJf "$tarball" --no-same-owner --strip-components=1 -C /srv/zulip-node
|
||||
ln -sf /srv/zulip-node/bin/{node,npm,npx} /usr/local/bin
|
||||
rm -rf /usr/local/nvm
|
||||
ln -sf /srv/zulip-node/bin/{corepack,node,npm,npx} /usr/local/bin
|
||||
COREPACK_DEFAULT_TO_LATEST=0 /usr/local/bin/corepack enable
|
||||
|
||||
# Clean up after previous versions of this script
|
||||
rm -rf /srv/zulip-yarn /usr/bin/yarn /usr/local/nvm
|
||||
|
||||
check_version
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user