mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-06 22:26:45 +00:00
feat(pockethost): --extra-plugins
This commit is contained in:
parent
31e0e8885c
commit
5e9ed51be3
5
.changeset/light-toys-shout.md
Normal file
5
.changeset/light-toys-shout.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'pockethost': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Added `--extra-plugins` global switch to temporarily load extra plugins from CLI
|
@ -3,12 +3,17 @@ import {
|
|||||||
LoggerService,
|
LoggerService,
|
||||||
doServeAction,
|
doServeAction,
|
||||||
doServeSlugsFilter,
|
doServeSlugsFilter,
|
||||||
|
loadPlugins,
|
||||||
} from '../../../common'
|
} from '../../../common'
|
||||||
|
|
||||||
type Options = {
|
type GlobalOptions = {
|
||||||
isolate: boolean
|
extraPlugins: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Options = {
|
||||||
|
only: string[]
|
||||||
|
} & GlobalOptions
|
||||||
|
|
||||||
export const ServeCommand = async () => {
|
export const ServeCommand = async () => {
|
||||||
const serveSlugs = await doServeSlugsFilter([])
|
const serveSlugs = await doServeSlugsFilter([])
|
||||||
|
|
||||||
@ -24,12 +29,15 @@ export const ServeCommand = async () => {
|
|||||||
.filter((s) => serveSlugs.includes(s)),
|
.filter((s) => serveSlugs.includes(s)),
|
||||||
serveSlugs,
|
serveSlugs,
|
||||||
)
|
)
|
||||||
.action(async (options: Options) => {
|
.action(async (unused: Options, cmd: Command) => {
|
||||||
const logger = LoggerService().create(`ServeCommand`)
|
const logger = LoggerService().create(`ServeCommand`)
|
||||||
const { dbg, error, info, warn } = logger
|
const { dbg, error, info, warn } = logger
|
||||||
info(`Starting`)
|
info(`Starting`)
|
||||||
|
|
||||||
await doServeAction({ only: serveSlugs })
|
const { only, extraPlugins } = cmd.optsWithGlobals<Options>()
|
||||||
|
await loadPlugins(extraPlugins)
|
||||||
|
dbg(`CLI:`, cmd.optsWithGlobals())
|
||||||
|
await doServeAction({ only })
|
||||||
})
|
})
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ export const main = async () => {
|
|||||||
.name('pockethost')
|
.name('pockethost')
|
||||||
.description('Multitenant PocketBase hosting')
|
.description('Multitenant PocketBase hosting')
|
||||||
.version(version)
|
.version(version)
|
||||||
|
.option(`-e, --extra-plugins <plugins...>`, `Extra plugins to load`, [])
|
||||||
|
|
||||||
const commands = await doCliCommandsFilter([
|
const commands = await doCliCommandsFilter([
|
||||||
await ServeCommand(),
|
await ServeCommand(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user