xpb

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2023 License: MIT Imports: 9 Imported by: 0

README

xpocketbase

Plugin orientated custom pocketbase builder, inspired by xcaddy.

This is a working example of building pocketbase with plugin support on the server.

Requirements

  • Golang

Install

Install from source:

go install github.com/kennethklee/xpb/xpocketbase@latest

Usage

xpocketbase build <version> will build a pocketbase binary.

# Build a specific version of pocketbase
xpocketbase build master
xpocketbase build v0.8.0

# Build the examples/base pocketbase
xpocketbase build latest \
    --with github.com/kennethklee/xpb/plugins/static \
    --with github.com/kennethklee/xpb/plugins/migrations-js \
    --with github.com/kennethklee/xpb/plugins/timeouts

# Build with plugin module in current directory
xpocketbase build latest \
    --with my-module=.

# Specific version
xpocketbase build latest \
    --with github.com/kennethklee/xpb/plugins/static@v1.0.0

# Replaces contents of module with contents elsewhere
xpocketbase build latest \
    --with github.com/kennethklee/xpb/plugins/static@v1.0.0=../plugins/static

# go build flags
xpocketbase build latest \
    --with github.com/kennethklee/xpb/plugins/static@v1.0.0 \
    -- -ldflags "-s -w"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FireOnLoad

func FireOnLoad(app core.App) (err error)

func FireOnPreload

func FireOnPreload() (err error)

func Register

func Register(plugin Plugin)

Types

type Builder

type Builder struct {
	TempProjectDir string // path to the temp custom pocketbase project directory
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder(pbVersion string, pluginStrs ...string) (*Builder, error)

func (*Builder) Close

func (b *Builder) Close() error

func (*Builder) Compile

func (b *Builder) Compile(buildArgs ...string) error

func (*Builder) Run

func (b *Builder) Run(args ...string) error

type Plugin

type Plugin interface {
	/**
	 * Preload is called before the app is setup.
	 * This is a good place to load configurations.
	 */
	OnPreload() error

	/**
	 * Load is called after the app is setup.
	 * This is a good place to register commands
	 * and hooks.
	 */
	OnLoad(app core.App) error

	/**
	 * Get plugin info
	 */
	Info() PluginInfo
}

func GetPlugins

func GetPlugins() []Plugin

type PluginInfo

type PluginInfo struct {
	Name        string
	Version     string
	Description string
}

For display purposes only

Directories

Path Synopsis
plugins
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL