diff --git a/scripts/layered.sh b/scripts/layered.sh index cee172e6cfe..696a25f582e 100755 --- a/scripts/layered.sh +++ b/scripts/layered.sh @@ -20,27 +20,21 @@ pnpm install --frozen-lockfile export PR_ORG=element-hq export PR_REPO=element-web -# Set up the js-sdk first -scripts/fetchdep.sh matrix-org matrix-js-sdk develop -pushd matrix-js-sdk -[ -n "$JS_SDK_GITHUB_BASE_REF" ] && git fetch --depth 1 origin $JS_SDK_GITHUB_BASE_REF && git checkout $JS_SDK_GITHUB_BASE_REF -pnpm link -pnpm install --frozen-lockfile -popd - -# Also set up matrix-analytics-events for branch with matching name -scripts/fetchdep.sh matrix-org matrix-analytics-events -# We don't pass a default branch so cloning may fail when we are not in a PR -# This is expected as this project does not share a release cycle but we still branch match it -if [ -d matrix-analytics-events ]; then - pushd matrix-analytics-events +js_sdk_dep=`jq -r '.dependencies["matrix-js-sdk"]' < package.json` + +# Set up the js-sdk first (unless package.json pins a specific version) +if [ "$js_sdk_dep" = "github:matrix-org/matrix-js-sdk#develop" ]; then + scripts/fetchdep.sh matrix-org matrix-js-sdk develop + pushd matrix-js-sdk + [ -n "$JS_SDK_GITHUB_BASE_REF" ] && git fetch --depth 1 origin $JS_SDK_GITHUB_BASE_REF && git checkout $JS_SDK_GITHUB_BASE_REF pnpm link pnpm install --frozen-lockfile - pnpm build:ts popd + + # Link into into element-web + pnpm link matrix-js-sdk +else + echo "Skipping matrix-js-sdk fetch and link as package.json pins $js_sdk_dep" fi -# Link the layers into element-web -pnpm link matrix-js-sdk -[ -d matrix-analytics-events ] && pnpm link @matrix-org/analytics-events pnpm install --frozen-lockfile $@