mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-05 21:56:48 +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,
|
||||
doServeAction,
|
||||
doServeSlugsFilter,
|
||||
loadPlugins,
|
||||
} from '../../../common'
|
||||
|
||||
type Options = {
|
||||
isolate: boolean
|
||||
type GlobalOptions = {
|
||||
extraPlugins: string[]
|
||||
}
|
||||
|
||||
type Options = {
|
||||
only: string[]
|
||||
} & GlobalOptions
|
||||
|
||||
export const ServeCommand = async () => {
|
||||
const serveSlugs = await doServeSlugsFilter([])
|
||||
|
||||
@ -24,12 +29,15 @@ export const ServeCommand = async () => {
|
||||
.filter((s) => serveSlugs.includes(s)),
|
||||
serveSlugs,
|
||||
)
|
||||
.action(async (options: Options) => {
|
||||
.action(async (unused: Options, cmd: Command) => {
|
||||
const logger = LoggerService().create(`ServeCommand`)
|
||||
const { dbg, error, info, warn } = logger
|
||||
info(`Starting`)
|
||||
|
||||
await doServeAction({ only: serveSlugs })
|
||||
const { only, extraPlugins } = cmd.optsWithGlobals<Options>()
|
||||
await loadPlugins(extraPlugins)
|
||||
dbg(`CLI:`, cmd.optsWithGlobals())
|
||||
await doServeAction({ only })
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ export const main = async () => {
|
||||
.name('pockethost')
|
||||
.description('Multitenant PocketBase hosting')
|
||||
.version(version)
|
||||
.option(`-e, --extra-plugins <plugins...>`, `Extra plugins to load`, [])
|
||||
|
||||
const commands = await doCliCommandsFilter([
|
||||
await ServeCommand(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user