Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 10 additions & 21 deletions .buildkite/commands/install-node-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,25 @@ else
PATCHES_HASH=nopatch
fi

CACHEKEY="$BUILDKITE_PIPELINE_SLUG-npm-$PLATFORM-$ARCHITECTURE-node-$NODE_VERSION-$PACKAGE_HASH-$PATCHES_HASH"
CACHEKEY="$BUILDKITE_PIPELINE_SLUG-pnpm-$PLATFORM-$ARCHITECTURE-node-$NODE_VERSION-$PACKAGE_HASH-$PATCHES_HASH"

LOCAL_NPM_CACHE=./vendor/npm
LOCAL_NPM_CACHE=./vendor/pnpm
mkdir -p $LOCAL_NPM_CACHE
echo "--- :npm: Set npm to use $LOCAL_NPM_CACHE for cache"
npm set cache $LOCAL_NPM_CACHE
echo "npm cache set to $(npm get cache)"

echo "--- :npm: Restore npm cache if present"
echo "--- :npm: Restore pnpm cache if present"
restore_cache "$CACHEKEY"

echo "--- :npm: Install Node dependencies"

MAX_SOCKETS=15 # Default value from npm
corepack enable pnpm

# To avoid constant ECONNRESET errors a limit is set for Linux,
# as this is not happening with the Mac jobs.
# This issue is being tracked here:
# https://github.com/npm/cli/issues/4652
if [ "$PLATFORM" = "Linux" ]; then
MAX_SOCKETS=1
fi
pnpm install \
--store-dir $LOCAL_NPM_CACHE \
--frozen-lockfile

npm ci \
--unsafe-perm \
--prefer-offline \
--no-audit \
--no-progress \
--maxsockets "$MAX_SOCKETS" \
"$@"
cd cli; pnpm install \
--store-dir $LOCAL_NPM_CACHE \
--frozen-lockfile

echo "--- :npm: Save cache if necessary"
# Notice that we don't cache the local node_modules.
Expand Down
5 changes: 3 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
"license": "GPL-2.0-or-later",
"main": "index.js",
"dependencies": {
"pm2": "^5.3.0",
"http-proxy": "^1.18.1"
"http-proxy": "^1.18.1",
"patch-package": "^8.0.0",
"pm2": "^5.3.0"
},
"scripts": {
"postinstall": "patch-package"
Expand Down
Loading
Loading