The project requires node >=12.13.0 and uses Yarn 1.22.x instead of npm.
To check if you have the required versions installed you can run:
node --version && yarn --version
Do NOT use npm install
to install packages!
To install all dependencies you can just run:
yarn
To add new dependencies to the project use:
yarn add [package-name] --dev
To test the widget locally you can add it to a room using /addwidget https://localhost:3000?theme=$theme&room=M.misc
. This will only work in a chrome instance that is started with --allow-insecure-localhost --disable-site-isolation-trials --disable-web-security
flags.
WARNING: Do not use this chrome instance to browse the web!
- Open Edit Run/Debug configurations by clicking on
ADD CONFIGURATION
from the popup window on the left there is node.js templateapp
click and switch toBrowser / Live Edit
tab - Click on the three dots next to your default browser
...
and then click on+
icon or ⌘+N (Mac) or Ctrl+N (Windows) - The browser entry is added to the end of the list. Click on the Name to change it to
insecure
for example. - Edit the browser by clicking on the pen icon, add this line
--allow-insecure-localhost --disable-site-isolation-trials --disable-web-security
hitOK
and another timeOK
- In the
Browser / Live Edit
tab from the drop down choose your newly added browser hitApply
andOK
WARNING: Do not use this chrome instance to browse the web!
You can install this plugin to get syntax highlighting on styled-components CSS
Click the run icon on top of the window or ⌃+R (Mac) Ctrl+R (Windows) to run or ⌃+D (Mac) Ctrl+D (Windows) to Debug
If you are using vscode you have to install the recommended extensions first.
Hit F1 and type Show Recommended Extensions
or filter extensions by @recommended
.
Install all Workspace Recommendations that are listed in the extensions panel.
The project is configured to support debugging within vscode.
Hit F5 to start a pre-configured chrome instance with the debugger attached.
WARNING: Do not use this chrome instance to browse the web!
You should install the following chrome extensions on first run:
- React Developer Tools
- Redux DevTools
In the project directory, you can run:
Runs the app in development mode.
Open https://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Some commands to build and run the application using docker.
Use this command to build the docker image.
Use this command to inspect the image that has been builded using yarn docker:build
Use this command to run a container based on the image that has been builded using yarn docker:build
Open http://localhost:3000 to view it in the browser.
Use this command to stop the container that has been started using yarn docker:run
Use this command to stop and remove the container that has been started using yarn docker:run
REACT_APP_HOME_SERVER_URL=https://matrix.org // optional
REACT_APP_PRIMARY_COLOR=#b0131d // optional