Developing your Desktop App
Following the recent changes in the codebase, developing desktop apps takes into consideration the use of TypeScript 4. This adoption is aimed at addressing maintainability concerns. Consult the TypeScript 4 release handbook to stay informed and updated..
src/main.ts: The script running at the main Electron process, orchestrating the whole application.
src/rootWindow.ts: The script that renders the UI of the root window which serves as the app's main window;
src/preload.ts: The script runs in a privileged mode to connect the app and the webviews rendering Rocket.Chat's web client.
Adding Node.js Modules
When extending the app's functionalities with modules, it's crucial to distinguish between modules required as
dependenciesand those marked as
package.jsonfile. Similar to any other project relying on packages, only modules listed in
dependencieswill be included in the final distributable app.
When extending the app's functionalities with modules, it's crucial to distinguish between modules required as dependencies and those marked as devDependencies in the package.json file. Similar to any other project relying on packages, only modules specified under dependencies will be incorporated into the eventual distributable application.
To establish automatic connections when the application launches, you can define default servers. This involves creating a
servers.jsonfile in the root directory of the project. This configuration ensures that the server list sidebar is automatically populated when the app launches or when all servers are deleted.
servers.jsonfile syntax is as follows:
"Demo Rocket Chat": "https://demo.rocket.chat",
"Open Rocket Chat": "https://open.rocket.chat",
"Awesome Rocket Chat": "https://awesome.rocket.chat"
Pre-Release Server Configuration
You have the option to bundle a
servers.jsonfile with the installation package. This file should be located at the root level of the project application, in the same directory as the
package.jsonfile. When the file is located, the initial "Connect to server" screen won't appear. Instead, the app will try to connect to the first server listed in the array. Once connected, the user will be taken directly to the login screen.
Please be aware that the
servers.jsonfile will only be checked if no other servers have been added previously. Even if you uninstall the app without removing previous preferences, this check will not be triggered again.
Post-Install Server Configuration
If you are unable or prefer not to include the file within the app bundle, an alternative approach is available. You can generate a servers.json file in the user preferences folder, which will override the packaged one. This file should be positioned in any of the directories outlined below depending on your operating system:
Run this command to execute tests on your changes:
Making a Release
To bundle your application into an installer, utilize the following command:
This command initiates the packaging procedure for the specific operating system you're currently using. Once completed, the resulting output file is prepared for distribution and can be located in the dist/ directory.
Last modified 3mo ago