Merge remote-tracking branch 'origin/develop' into palid/fix/layers-overwhelming

* origin/develop:
  Fix import breaking types in release mode
  Fix resizer for detaching
  Add CI script to switch the js-sdk into 'release mode'
This commit is contained in:
Dariusz Niemczyk 2021-08-24 19:36:58 +02:00
commit ff048b0067
No known key found for this signature in database
GPG key ID: 3E8DC619E3C59A05
3 changed files with 23 additions and 2 deletions

21
scripts/ci/js-sdk-to-release.sh Executable file
View file

@ -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

View file

@ -84,7 +84,7 @@ export default class Resizer<C extends IConfig = IConfig> {
}
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);
}

View file

@ -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 */