mirror of
https://github.com/pockethost/pockethost.git
synced 2025-09-15 21:20:11 +00:00
feat(pockethost): new action PluginsLoaded
This commit is contained in:
parent
52b70cbe76
commit
cce72b35e2
5
.changeset/tricky-trees-wave.md
Normal file
5
.changeset/tricky-trees-wave.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'pockethost': minor
|
||||
---
|
||||
|
||||
New action: AfterPluginsLoaded
|
@ -133,6 +133,10 @@ onServeAction(async ({ only }) => {
|
||||
| InstanceLog | A log action | logLevel, currentLogLevel, args | [example](https://github.com/pockethost/pockethost/blob/e6355c1aea2484ffba9d95110faa2af40e922855/packages/plugin-launcher-spawn/src/index.ts#L147) | 1.3.0 |
|
||||
| Serve | The `pockethost serve` command has been called | only[] | | 1.4.0 |
|
||||
|
||||
#### AfterPluginsLoaded (since 1.6.0)
|
||||
|
||||
Fired after all plugins have been loaded. This is a good time to perform initialization that may depend upon other plugins.
|
||||
|
||||
### Core Filters
|
||||
|
||||
#### ServerSlugs (since 1.4.0)
|
||||
|
@ -10,6 +10,7 @@ import {
|
||||
DEBUG,
|
||||
LogLevelName,
|
||||
LoggerService,
|
||||
doAfterPluginsLoadedAction,
|
||||
doCliCommandsFilter,
|
||||
loadPlugins,
|
||||
} from '../common'
|
||||
@ -45,6 +46,8 @@ export const main = async () => {
|
||||
|
||||
await loadPlugins([pockethost, ...uniq(PH_PLUGINS()), ...extraPlugins])
|
||||
|
||||
await doAfterPluginsLoadedAction()
|
||||
|
||||
program
|
||||
.name('pockethost')
|
||||
.description('Multitenant PocketBase hosting')
|
||||
|
@ -4,6 +4,7 @@ import { DEBUG } from '../debug'
|
||||
import { InstanceFields } from '../schema'
|
||||
|
||||
enum CoreActions {
|
||||
AfterPluginsLoaded = 'core_after_plugins_loaded',
|
||||
Init = 'core_init',
|
||||
Serve = 'core_serve',
|
||||
AppMounted = 'core_on_app_mount',
|
||||
@ -70,6 +71,9 @@ export function createCustomAction(actionName: CoreActions) {
|
||||
] as const
|
||||
}
|
||||
|
||||
export const [doAfterPluginsLoadedAction, onAfterPluginsLoadedAction] =
|
||||
createCustomAction(CoreActions.AfterPluginsLoaded)
|
||||
|
||||
export const [doRequestErrorAction, onRequestErrorAction] =
|
||||
createCustomActionWithContext<{
|
||||
err: Error
|
||||
|
Loading…
x
Reference in New Issue
Block a user