Skip to content

Commit

Permalink
Document package extensions (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickrum authored Jul 18, 2022
1 parent 9b254b7 commit d1c453d
Showing 1 changed file with 42 additions and 12 deletions.
54 changes: 42 additions & 12 deletions extensions/creating-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,6 @@ the config file can be loaded as a CommonJS or ESM file.

:::

## Deploying your Extension

To deploy your extension, you have to move the output from the `dist/` folder into your project's
`./extensions/<extension-folder>/<extension-name>/` folder. `<extension-folder>` has to be replaced by the extension
type in plural form (e.g. interfaces). `<extension-name>` should be replaced with the name of your extension.

::: warning Configurable Folders

The path to the built extension as well as the extensions directory are configurable and may be located elsewhere.

:::

## Developing your Extension

To learn more about developing extensions of a specific type, you can refer to one of the individual guides:
Expand All @@ -127,3 +115,45 @@ When working on extensions, try setting the
on changes automatically.

:::

## Publishing your Extension

To make an extension available to all Directus users, you can publish the npm package created by
`@directus/extensions-sdk` to the npm registry. Make sure the name of the package follows the naming convention for
package extensions: `directus-extension-<extension-name>` or `@<scope>/directus-extension-<extension-name>`.
`<extension-name>` has to be replaced with the name of your extension.

## Installing an Extension

There are two ways to install an extension.

### Package Extension

Package extensions are essentially npm packages. They can be installed from the npm registry, from a tarball, from a git
repository or any other means supported by npm. On startup, Directus will automatically load any package extension
installed into your Directus project folder.

To install an extension from the npm registry, simply use the npm CLI:

```bash
cd <directus-project-folder>
npm install <full-package-extension-name>
```

`<project-folder>` has to be replaced by the Directus project folder. `<full-package-extension-name>` should be replaced
with the full name of the package extension (e.g. `directus-extension-custom`).

### Local Extension

Local extensions are essentially the files generated by the `directus-extension build` command. They can be installed by
copying those files into a specific extensions folder.

To install an extension locally, you have to move the output from the `dist/` folder into your project's
`./extensions/<extension-folder>/<extension-name>/` folder. `<extension-folder>` has to be replaced by the extension
type in plural form (e.g. interfaces). `<extension-name>` should be replaced with the name of your extension.

::: warning Configurable Folders

The path to the built extension as well as the extensions directory are configurable and may be located elsewhere.

:::

0 comments on commit d1c453d

Please sign in to comment.