From a2f581a7effa3f572c9cf341a54d2b493b05f472 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 15 Jul 2021 13:53:41 +0100 Subject: [PATCH 1/3] Add CI script to switch the js-sdk into 'release mode' So we can check the types still work against a released js-sdk --- scripts/ci/js-sdk-to-release.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 scripts/ci/js-sdk-to-release.sh diff --git a/scripts/ci/js-sdk-to-release.sh b/scripts/ci/js-sdk-to-release.sh new file mode 100755 index 0000000000..a03165bd82 --- /dev/null +++ b/scripts/ci/js-sdk-to-release.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# This changes the js-sdk into 'release mode', that is: +# * The entry point for the library is the babel-compiled lib/index.js rather than src/index.ts +# * There's a 'typings' entry referencing the types output by tsc +# We do this so we can test that each PR still builds / type checks correctly when built +# against the released js-sdk, because if you do things like `import { User } from 'matrix-js-sdk';` +# rather than `import { User } from 'matrix-js-sdk/src/models/user';` it will work fine with the +# js-sdk in development mode but then break at release time. +# We can't use the last release of the js-sdk though: it might not be up to date enough. + +cd node_modules/matrix-js-sdk +for i in main typings +do + lib_value=$(jq -r ".matrix_lib_$i" package.json) + if [ "$lib_value" != "null" ]; then + jq ".$i = .matrix_lib_$i" package.json > package.json.new && mv package.json.new package.json + fi +done +yarn run build:compile +yarn run build:types From d8e7fd3634cecaabef6ecc773148025a4ca08f75 Mon Sep 17 00:00:00 2001 From: Dariusz Niemczyk Date: Tue, 24 Aug 2021 18:22:06 +0200 Subject: [PATCH 2/3] Fix resizer for detaching --- src/resizer/resizer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resizer/resizer.ts b/src/resizer/resizer.ts index 19af425b8b..0db13e1af5 100644 --- a/src/resizer/resizer.ts +++ b/src/resizer/resizer.ts @@ -84,7 +84,7 @@ export default class Resizer { } public detach() { - const attachment = this?.config?.handler.parentElement ?? this.container; + const attachment = this?.config?.handler?.parentElement ?? this.container; attachment.removeEventListener("mousedown", this.onMouseDown, false); window.removeEventListener("resize", this.onResize); } From c3e173248da02eb25b0b2ea94e991b743e06c593 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 24 Aug 2021 17:43:23 +0100 Subject: [PATCH 3/3] Fix import breaking types in release mode --- src/sentry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sentry.ts b/src/sentry.ts index 59152f66f2..206ff9811b 100644 --- a/src/sentry.ts +++ b/src/sentry.ts @@ -19,7 +19,7 @@ import PlatformPeg from "./PlatformPeg"; import SdkConfig from "./SdkConfig"; import { MatrixClientPeg } from "./MatrixClientPeg"; import SettingsStore from "./settings/SettingsStore"; -import { MatrixClient } from "matrix-js-sdk"; +import { MatrixClient } from "matrix-js-sdk/src/client"; /* eslint-disable camelcase */