Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit dbc69fb

Browse files
authored
Merge pull request #6383 from matrix-org/dbkr/ci_for_release_mode_types
Add CI script to switch the js-sdk into 'release mode'
2 parents fa725a7 + a2f581a commit dbc69fb

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

scripts/ci/js-sdk-to-release.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
3+
# This changes the js-sdk into 'release mode', that is:
4+
# * The entry point for the library is the babel-compiled lib/index.js rather than src/index.ts
5+
# * There's a 'typings' entry referencing the types output by tsc
6+
# We do this so we can test that each PR still builds / type checks correctly when built
7+
# against the released js-sdk, because if you do things like `import { User } from 'matrix-js-sdk';`
8+
# rather than `import { User } from 'matrix-js-sdk/src/models/user';` it will work fine with the
9+
# js-sdk in development mode but then break at release time.
10+
# We can't use the last release of the js-sdk though: it might not be up to date enough.
11+
12+
cd node_modules/matrix-js-sdk
13+
for i in main typings
14+
do
15+
lib_value=$(jq -r ".matrix_lib_$i" package.json)
16+
if [ "$lib_value" != "null" ]; then
17+
jq ".$i = .matrix_lib_$i" package.json > package.json.new && mv package.json.new package.json
18+
fi
19+
done
20+
yarn run build:compile
21+
yarn run build:types

0 commit comments

Comments
 (0)