Bundling Extensions
Bundles are a way to group extensions together as a single distributable package. They can be used when extensions should be installed together or to combine and share dependencies.
Creating a Bundle
When creating an extension, select a bundle
type. This will create a new empty bundle.
Entries
In your bundle's package.json
file, the directus:extension
object has an entries
array that describes all of the items contained within the bundle. Entries in a bundle are located within a src
directory in the bundle.
{
"type": "interface",
"name": "my-interface",
"source": "src/my-interface/index.ts"
}
Partial
For bundle type extensions package.json
file, the directus:extension
object supports an additional optional partial
property. This boolean property controls whether the bundles entries can be individually disabled. This is enabled by default.
Add an Extension
Create New
- Navigate to your bundle extension directory in your terminal.
- Use the
npm run add
command and select an extension type.
This will create a boilerplate extension.
Add Existing
- Move your extension directory within your bundle's
src
directory. - Add an entry to the bundle's
package.json
.
Remove an Extension
- Delete the extension directory from your
src
directory. - Remove the entry from your
package.json
.