1
0
mirror of https://github.com/element-hq/element-web.git synced 2026-10-24 23:19:26 +03:00
Files
element-web/scripts/layered.sh
Richard van der Hoff 3ffa4135cf CI: layered.sh: better replicate clean install (#34989)
* vitepress: update path to matrix-js-sdk

matrix-js-sdk is only required by apps/web, so is not (usually) found in the
top-level node_modules.

* Add more dependencies to list to be babeled for jest

In particular: `content-type`, `bs58` and `base-x`. These are transitive deps
of matrix-js-sdk, so are often installed under `node_moduled` and hence get
covered by the exclusion for `matrix-js-sdk`, but if they get hoisted to the
top of node_modules, then we get test failures.

* Update matrix-widget-api

The js-sdk depends on stuff in 1.19.0, so we need to update.

* CI: layered.sh: avoid pnpm link

`pnpm link` does not accurately reproduce the behaviour of installing the
package from git/npm, leading to surprise compile failures for people that
attempt to do the latter.

So, instead, let's build the js-sdk's package as a tarball, then install that.

* Clean up tsc includes for playwright dir

* silence sonarcloud whining

* lint
2026-09-11 15:42:53 +00:00

51 lines
2.1 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
# Install matrix-js-sdk's build dependencies
pnpm -C matrix-js-sdk install --frozen-lockfile --ignore-scripts
# Rather than using `pnpm link` (or `pnpm install ./matrix-js-sdk`, which
# does the same thing), we build the js-sdk into a tarball and then install
# that.
#
# This is preferable because it better reflects the behaviour when doing a clean
# `pnpm install` in a checkout of element-web: for example, js-sdk dependencies may
# be hoisted and shared with element-web, and there is no tsconfig.json.
pnpm -C matrix-js-sdk pack --out matrix-js-sdk.tgz
pnpm -C apps/web install $(pwd)/matrix-js-sdk/matrix-js-sdk.tgz
else
echo "layered.sh: Skipping matrix-js-sdk fetch and install as package.json pins $js_sdk_dep"
fi