Plugins
You may create, manage, and host your own custom plugins with the help of the dyte plugins
subcommand.
Overview
You can publish plugins for your organization on Dyte. We manage only the client-side code for plugins, the backend for a plugin (if any) will not be hosted by Dyte. Therefore, server-side templating is not supported in plugins.
Every functional Dyte plugin requires a configuration file, which is named dyte-config.json
by default. This contains details about the plugin such as the pluginId
, name
, version
, description
, etc. This file is auto-generated upon running the dyte plugins create
command, which is explained in detail later. You can know more about the dyte-config.json
file in the description for the publish
subcommand.
TL;DR
In order to create and publish a plugin, you need to do the following.
- Run
dyte plugins create
, and enter the details. This should create adyte-config.json
file. - Copy the
dyte-config.json
into the folder containing theindex.html
file of your plugin. If you're using a frontend library like React, this would be the build folder. - Change your directory to the folder containing the
index.html
anddyte-config.json
files. - Modify the
dyte-config.json
file to update the version and the files that will be included and excluded while generating the plugin archive. - Run
dyte plugins publish -l
ordyte plugins publish --latest
to upload and serve your plugin on Dyte.
Usage
Creating a plugin
You can use the following subcommand to create a new Dyte plugin. This sends an API request to register a new plugin under your organization. Additionally, it creates a file called dyte-config.json
, which is essential for the plugin to function properly.
dyte plugins create
Listing your plugins
The list | ls
subcommand can be used to list the names and IDs of all plugins that were created by your organization.
dyte plugins ls
Viewing plugin details
The describe
subcommand logs the details of a plugin. The pluginId
is required.
dyte plugins describe -p <plugin id>
Deleting a plugin
With the help of the delete | rm
subcommand, you can delete an existing plugin. The pluginId
is required.
dyte plugins rm -p <plugin id>
Updating a plugin
To update the details of a plugin, you can use the update
subcommand. The pluginId
is required.
dyte plugins update -p <plugin id>
Releasing plugins
Packaging a plugin
In order to publish a plugin, a .dyt
archive is created with all the client-side source code and the dyte-config.json
file. This file is required by the publish
subcommand, which also internally generates this archive. You can use the pack
command if you just want to generate the archive, but do not want to publish it.
dyte plugins pack
Publishing a plugin
The publish
subcommand handles publishing a plugin on Dyte. You must run this command in the directory where the dyte-config.json
and the index.html
files of your plugin are present. In the dyte-config.json
, you can also describe the files you want to include in and exclude from the archive. In order to publish a plugin, you must follow these steps:
- Copy the
dyte-config.json
(which was created by thedyte plugins create
command) into the folder containing yourindex.html
file. In case you're using a frontend library like React, you must copydyte-config.json
into thebuild
folder. - Update the plugin version in
dyte-config.json
. - Run
dyte plugins publish -l
.
The -l
or --latest
option is required if you want your plugin's new version to be deployed. If the -l
option is absent, the new version of the plugin will be saved in our storage bucket, but it will not be served. In that case, an older version (if any) will be served. You may not use the -l
option if you want to upload your code to the storage bucket but you do not want to serve it.
dyte plugins publish -l
Unpublishing a plugin
The unpublish
subcommand can be used if you want do not want your plugin to show up on the Dyte plugins panel. The pluginId
is required.
dyte plugins unpublish
Note that the plugin and its code will not be deleted, it will just not show up on the panel (and thus become unusable).
Versioning
The version
subcommand has 3 subcommands of its own. The pluginId
is required for each of these subcommands.
List
version list
can be used to list all versions of your Dyte plugin.
dyte plugins version list
Delete
version delete
can be used to delete a particular version of your Dyte plugin. This accepts the version you want to delete with the help of the -v
option.
dyte plugins version delete -v <version>
Change latest
version change-latest
can be used to change the version of your plugin that is served. This accepts the version you want to serve with the help of the -v
option.
dyte plugins version change-latest -v <version>