Web app workflow
This page contains most of the information required for a developer to work with the Mattermost web app. Note that everything in this document will refer to working in the webapp directory of the main Mattermost repository unless otherwise stated.
Workflow
-
If you haven't done so already, set up your developer environment.
-
On your fork, create a feature branch for your changes. Name it
MM-$NUMBER_$DESCRIPTIONwhere$NUMBERis the Jira ticket number you are working on and$DESCRIPTIONis a short description of your changes. Example branch names areMM-18150_plugin-panic-logandMM-22037_uppercase-email. You can also use the nameGH-$NUMBER_$DESCRIPTIONfor tickets come from GitHub Issues. -
Make the code changes required to complete your ticket, making sure to write or modify unit tests where appropriate. Use
make testto run the unit tests. -
To run your changes locally, you'll need to run both the client and server. The server and client can either be run together or separately as follows:
-
You can run both together by using
make runfrom the server directory. Both server and web app will be run together and can be stopped by usingmake stop. If you run into problems getting the server running this way, you may want to consider running them separately in case the output from one is hiding errors from the other. -
You can run the server independently by running
make run-serverfrom its directory and, using another terminal, you can run the web app by runningmake runfrom the web app directory. Each can be stopped by runningmake stop-serverormake stopfrom their respective directories.
Once you've done either of those, your server will be available at
http://localhost:8065by default. Changes to the web app will be built automatically, but changes to the server will only be applied if you restart the server by runningmake restart-serverfrom the server directory. -
-
If you added or changed any translatable text, you will need to update the English translation files to make them available to translators for other languages. You can do that by navigating to
channelsand runningmake i18n-extractto updatesrc/i18n/en.json.- Remember to double check that any newly added strings have the correct values in case they weren't detected correctly.
- Generally, only
en.jsonshould be modified directly from this repository. Other languages' translation files are updated using Weblate.
-
Before submitting a PR, make sure to check your coding style and run the automated tests on your changes. These are checked automatically by CI, but they should be run manually before submitting changes to ensure the review process goes smoothly.
- To check the code style and run the linter, run
make check-style. If any problems are encountered, they may be able to be automatically fixed by usingmake fix-style. - To run the type checker, use
make check-types. - To run the unit tests, run
make test.
- To check the code style and run the linter, run
-
Commit your changes, push your branch and create a pull request.
-
Respond to feedback on your pull request and make changes as necessary by committing to your branch and pushing it. Your branch should be kept roughly up to date by merging master into it periodically. This can either be done using
git mergeor, as long as there are no conflicts, by commenting/update-branchon the PR. -
That's it! Rejoice that you've helped make Mattermost better.
Useful Mattermost commands
During development you may want to reset the database and generate random data for testing your changes. See the corresponding section of the server developer workflow for how to do that.