diff --git a/.changeset/cyan-cherries-doubt.md b/.changeset/cyan-cherries-doubt.md new file mode 100644 index 00000000..1d053feb --- /dev/null +++ b/.changeset/cyan-cherries-doubt.md @@ -0,0 +1,5 @@ +--- +'pockethost': patch +--- + +Plugin authoring docs update diff --git a/packages/pockethost/plugin-guide.md b/packages/pockethost/plugin-guide.md index 34c04395..519a96ea 100644 --- a/packages/pockethost/plugin-guide.md +++ b/packages/pockethost/plugin-guide.md @@ -53,7 +53,44 @@ A plugin is an npm package. Run `pockethost plugin create ` to c ## Core Filters -| Name | Description | Context | Since | -| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------- | ----- | -| CliCommands | Gather all CLI commands | | 1.3.0 | -| ServerSlugs | The items available to the `--only` switch of `pockethost serve`. `--only` controls which services should respond to the `Serve` action. | | 1.4.0 | +### ServerSlugs (since 1.4.0) + +The items available to the `--only` switch of `pockethost serve`. `--only` controls which services should respond to the `Serve` action. + +```ts +const slugs = await doServeSlugsFilter([]) +``` + +```ts +onServeSlugsFilter(async (slugs) => { + return [...slugs, 'maildev'] +}) +``` + +### InstanceConfig (since 1.5.0) + +Configure instance `env` and `binds` before launch. + +```ts +const config = await doInstanceConfigFilter({ + env: {}, + binds: { + data: [], + hooks: [], + migrations: [], + public: [], + }, +}) +``` + +```ts +import { produce } from 'immer' +onInstanceConfigFilter(async (config) => { + return produce(config, (draft) => { + draft.binds.hooks.push({ + src: PH_PROJECT_DIR(`src/instance-app/hooks/**/*`), + base: PH_PROJECT_DIR(`src/instance-app/hooks`), + }) + }) +}) +```