build

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package build implements `gombit build --embed`: Vite production build, collectstatic into internal/web/static, and `go build` of a single binary that serves API + static + SPA fallback. Split deploy stays the default (C5); embedding is opt-in.

Index

Constants

View Source
const (
	// DefaultOut is the server binary path when --out is omitted.
	DefaultOut = "bin/server"
)

Variables

View Source
var ErrEmbedRequired = errors.New("build: split deploy is the default (C5). Embedding the Vite frontend is opt-in; pass --embed to collectstatic frontend/dist into internal/web/static and compile a single binary that serves API + static + SPA fallback")

ErrEmbedRequired is returned when gombit build is invoked without --embed. Split deploy stays the default (C5).

Functions

func CollectStatic

func CollectStatic(srcDir, dstDir string) error

CollectStatic copies srcDir (frontend/dist) into dstDir (internal/web/static), replacing previous assets but leaving .keep and never touching embed.go.

func Run

func Run(ctx context.Context, opts Options) error

Run performs the embed production build from an application directory.

Types

type CommandFunc

type CommandFunc func(name string, args ...string) *exec.Cmd

CommandFunc starts a subprocess. Tests replace this with short-lived fakes.

type LookPathFunc

type LookPathFunc func(file string) (string, error)

LookPathFunc locates an executable. Tests replace this to simulate npm/go.

type Options

type Options struct {
	WorkDir  string
	Out      string
	Embed    bool
	DryRun   bool
	Stdout   io.Writer
	Stderr   io.Writer
	LookPath LookPathFunc
	Command  CommandFunc
}

Options configures `gombit build --embed`.

Jump to

Keyboard shortcuts

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