Now that Olm needs to be inited asynchronously anyway, we can just
pass the options to Olm.init(), and as long as we do that before we
start the js-sdk, we're all good.
This will means the olm js is now part of the main bundle but since
it's now just a wrapper around the wasm, this is probably faster.
Also add the directwatch flag to olm.wasm because otherwise it
doesn't seem to copy the file in watch mode...
* Olm no longer supports setting the stack/memory size at runtime,
so don't (they're now set to be that in the Olm build).
* Copy the wasm file from the Olm library (see multiple comments
about it being in the wrong place and webpack being awful).
If we don't block on SDK builds, then the riot-web build fails due to half-built dependencies. This needs to be done at two levels: the js-sdk because it is used by both the react-sdk and riot-web, and at the react-sdk because riot-web needs it. This means our build process is synchronous for js -> react -> riot, at least for the initial build.
This does increase the startup time, particularly because the file watch timer is at 5 seconds. The timer is used to detect a storm of file changes in the underlying SDKs and give the build process some room to compile larger files if needed.
The file watcher is accompanied by a "canary signal file" to prevent the build-blocking script from unblocking too early. Both the js and react SDKs build when `npm install` is run, so we ensure that we only listen for the `npm start` build for each SDK.
This is all done at the riot level instead of at the individual SDK levels (where we could use a canary file to signal up the stack) because:
* babel (used by the js-sdk) doesn't really provide an "end up build" signal
* webpack is a bit of a nightmare to get it to behave at times
* this blocking approach is really only applicable to riot-web, although may be useful to some other projects.
Hopefully that all makes sense.
A step towards a real solution for https://github.com/vector-im/riot-web/issues/7305
This approach makes use of `npm link` to remove the use of symlinks in the build process. The build process has also been altered to invoke the build process of each underlying SDK (react, js). This means that one can now `npm link` and `npm start` and have a working environment.
At the same time, parallelshell was dropped due to lack of maintenance from the maintainer.
It was common, at least for me, to experience a crash produced
when running the `matrix-react-sdk/scripts/gen-i18n.js` script
because when writing en_EN.json (via the script or otherwise)
choikdar would receive an event and cause the file to be read,
but the file would be empty when clearly it wasn't.
This would happen even when doing an atomic write in gen-i18n.
The fix adds a debounce as a workaround.