Includes: compilation, translations, IDE support (use .tsx not .ts), typings, and other build tools.
TypeScript component have to import PropTypes and React with `import * as React from 'react';`
We were checking out & installing the develop js-sdk explicitly
in cases where we didn't need it at all. We were babeling the src
folder many, many times over (in some cases twice in the same job)
and never using the output at all.
With a switch to Only One Webpack™ we need a way to help developers generate the component index without a concurrent watch task. The best way to do this is to have developers import their components, but how do they do that when we support skins? The answer in this commit is to change skinning.
Skinning now expects to receive your list of overrides instead of the react-sdk+branded components. For Riot this means we send over *only* the Vector components and not Vector+react-sdk.
Components can then be annotated with the `replaceComponent` decorator to have them be skinnable. The decorator must take a string with the dot path of the component because we can't reliably calculate it ourselves, sadly.
The decorator does a call to `getComponent` which is where the important part of the branded components not including the react-sdk is important: if the branded app includes the react-sdk then the decorator gets executed before the skin has finished loading, leading to all kinds of fun errors. This is also why the skinner lazily loads the react-sdk components to avoid importing them too early, breaking the app.
The decorator will end up receiving null for a component because of the getComponent loop mentioned: the require() call is still in progress when the decorator is called, therefore we can't error out. All usages of getComponent() within the app are safe to not need such an error (the return won't be null, and developers shouldn't use getComponent() after this commit anyways).
The AuthPage, being a prominent component, has been converted to demonstrate this working. Changes to riot-web are required to have this work.
The reskindex script has also been altered to reflect these skinning changes - it no longer should set the react-sdk as a parent. The eventual end goal is to get rid of `getComponent()` entirely as it'll be easily replaced by imports.
If you try to clone a repo that doesn't exist via `https`, `git` will prompt for
auth credentials and hang forever. Using `git` avoids this and fails immediately
instead, which is what we want for a missing repo.
Part of https://github.com/vector-im/riot-web/issues/9221
Currently, people with push access to the main Riot repos can push matching
branch names to Riot and the SDKs, and CI will test all the branches together.
This change allows contributors to access the same ability when submitting
several matching PRs from their fork of each repo.
Part of https://github.com/vector-im/riot-web/issues/9041
Take advantage of Yarn's preservation of links while installing and set up links
first and install second. This should result in a small speedup since we no
longer install the published SDKs just to replace them on the next line.
Most `npm` operations are replaced with `yarn`, which generally has better
behavior. However, steps like publish that write to the NPM registry are left to
`npm`, which currently handles these tasks best.
Hopefully this will end up simpler than having to figure out in
riot-web what the relative path is from react-sdk's
src/languageHandler.js to riot-web's webapp directory.
And throw a massive tantrum if you've messed up your format strings.
Because broken format strings making their way into the app cause it
to throw exceptions.
Where by 'HTML' I mean just run the same regex as riot does over
some text.
Also make it walk multiple paths.
This mostly means it can be used for riot-web.