dev

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package dev implements `gombit dev`: one command that runs the Go API (with reload when air or watchexec is available), the Vite frontend with HMR, and live OpenAPI → TypeScript client regeneration.

Index

Constants

View Source
const (
	// DefaultHTTPAddr is the Go API listen address when config and flags omit it.
	DefaultHTTPAddr = ":8080"
	// DefaultFrontendHost is the Vite bind host.
	DefaultFrontendHost = "127.0.0.1"
	// DefaultFrontendPort is Vite's conventional port.
	DefaultFrontendPort = 5173
	// DefaultPollInterval is how often the OpenAPI watcher fetches /openapi.json.
	DefaultPollInterval = time.Second
	// DefaultClientOut is the generated TypeScript client directory (design §23.3).
	DefaultClientOut = client.DefaultOutDir
)

Variables

This section is empty.

Functions

func FormatServiceTable

func FormatServiceTable(services Services) string

FormatServiceTable renders the Backend / Frontend / OpenAPI / API docs table.

func HTTPAddrFromConfig

func HTTPAddrFromConfig(cfg config.Config) string

HTTPAddrFromConfig returns the listen address from cfg, or DefaultHTTPAddr.

func Run

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

Run starts the backend, Vite frontend, and OpenAPI client watcher until ctx is cancelled.

func ValidateFlags

func ValidateFlags(httpAddr string, frontendHost string, frontendPort int, poll time.Duration, clientOut string) error

ValidateFlags reports user-facing errors for `gombit dev` flag values before defaults are applied.

Types

type CommandFunc

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

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

type GenerateFunc

type GenerateFunc func(ctx context.Context, spec []byte) error

GenerateFunc regenerates the TypeScript client from an OpenAPI document.

type HTTPGetFunc

type HTTPGetFunc func(ctx context.Context, rawURL string) ([]byte, error)

HTTPGetFunc fetches a URL. Tests replace this to stub /openapi.json.

type LookPathFunc

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

LookPathFunc locates an executable. Tests replace this to simulate air/pnpm.

type Options

type Options struct {
	WorkDir      string
	HTTPAddr     string
	FrontendHost string
	FrontendPort int
	ClientOut    string
	PollInterval time.Duration
	Stdout       io.Writer
	Stderr       io.Writer
	LookPath     LookPathFunc
	Command      CommandFunc
	HTTPGet      HTTPGetFunc
	Generate     GenerateFunc
	ShutdownWait time.Duration
}

Options configures `gombit dev`.

type ProcSpec

type ProcSpec struct {
	Name string
	Dir  string
	Env  []string
	Path string
	Args []string
}

ProcSpec is one supervised child process.

type Services

type Services struct {
	Backend  string
	Frontend string
}

Services holds the URLs printed in the startup service table.

Jump to

Keyboard shortcuts

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