Files
ThreadNet-Web/scripts/layered.sh
T
Richard van der HoffandGitHub 4f15a084c0 Minor tweaks to the layered.sh build script (#34300)
I struggled to understand what was going on in my failing build. Clean up some
comments, and try to make the console output a bit more helpful.
2026-07-16 19:37:48 +00:00

43 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -ex
# Creates a layered environment with the full repo for the app and SDKs cloned
# and linked. This gives an element-web dev environment ready to build with
# matching branches of matrix-js-sdk so that changes can be tested
# in element-web.
# Note that this style is different from the recommended developer setup: this
# file nests js-sdk inside element-web, while the local
# development setup places them all at the same level. We are nesting them here
# because some CI systems do not allow moving to a directory above the checkout
# for the primary repo (element-web in this case).
# Install dependencies
pnpm install --frozen-lockfile $@
# Pass appropriate repo to fetchdep.sh
export PR_ORG=element-hq
export PR_REPO=element-web
js_sdk_dep=$(jq -r '.dependencies["matrix-js-sdk"]' < $(pnpm -w root)/../apps/web/package.json)
# Set up the js-sdk (unless package.json pins a specific version)
if [ "$js_sdk_dep" = "github:matrix-org/matrix-js-sdk#develop" ]; then
echo "layered.sh: Cloning matching branch of matrix-js-sdk"
scripts/fetchdep.sh matrix-org matrix-js-sdk develop
if [ -n "$JS_SDK_GITHUB_BASE_REF" ]; then
echo "layered.sh: Switching js-sdk to $JS_SDK_GITHUB_BASE_REF"
git -C matrix-js-sdk fetch --depth 1 origin $JS_SDK_GITHUB_BASE_REF
git -C matrix-js-sdk -c advice.detachedHead=false checkout $JS_SDK_GITHUB_BASE_REF
fi
pnpm -C matrix-js-sdk install --frozen-lockfile --ignore-scripts
# Link into into element-web & the monorepo
pnpm -C apps/web link ./matrix-js-sdk
pnpm link ./matrix-js-sdk
else
echo "layered.sh: Skipping matrix-js-sdk fetch and link as package.json pins $js_sdk_dep"
fi