β¨ Robo Plugins
Robo Plugins are special. They let you add features to your Robo with one command and integrate seamlessly thanks to the Robo File Structure. What's more, anyone can create a plugin.
You can install and manage plugins in Robo.js either using the Robo CLI or manually.
Using Robo CLIβ
The Robo CLI has its own commands install the plugin's NPM package and register it in your Robo's configuration.
When dealing with NPM packages, Robo CLI will use the executor command's package manager.
Command | Package Manager |
---|---|
npx robo add | npm install |
pnpm robo add | pnpm add |
yarn robo add | yarn add |
bun robo add | bun add |
Installβ
Run in your terminal, replacing <package>
with the name of the plugin you want to install (e.g. @robojs/ai):
npx robo add package
This will install the package and register it in your Robo's configuration. To install many at once:
npx robo add @robojs/ai @robojs/moderation @robojs/server
You can also create a new Robo project with plugins pre-installed:
npx create-robo projectName --plugins @robojs/ai @robojs/server
Uninstallβ
To remove a plugin:
npx robo remove package
This will uninstall the package and remove it from your Robo's configuration.
Updatesβ
You can use robo upgrade
to not only update Robo.js itself, but also all installed plugins.
npx robo upgrade
This will show you a list of updates and changelogs for you to select.
Manuallyβ
Don't want to use the Robo CLI? You can still install plugins manually. It's not as convenient as using the Robo CLI, but it's still a straightforward process.
Here's how you can do it:
Package Managerβ
Use the package manager of your choice to install the plugin:
npm install package
The same goes for bun
, pnpm
, and yarn
.
Register Pluginβ
Robo.js knows which plugins to use by looking the /config/plugins
directory.
For each plugin you want, create an .mjs
file in /config/plugins
with the same name as the plugin's package. The file should export the plugin's configuration.
export default {
// ... plugin configuration
}
Remember to delete the file if you uninstall the plugin.