scaffold

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package scaffold generates a new Gombit application (gombit new).

Index

Constants

View Source
const (
	// DefaultDatabase is the C1–C6 / D12 SQLite default.
	DefaultDatabase = "sqlite"
	// DefaultCache is the in-process memory cache default.
	DefaultCache = "memory"
	// DefaultAuth is Bearer JWT (C3). Cookie mode is first-class (M5-3).
	DefaultAuth = "jwt"
	// DefaultUI is minimal/headless (C4). --ui mui scaffolds the MUI CRUD preset.
	DefaultUI = "minimal"
	// DefaultAPIPrefix is D8.
	DefaultAPIPrefix = "/api/v1"
	// DefaultModulePrefix is the module path used when --module is omitted.
	DefaultModulePrefix = "github.com/example"
)
View Source
const FallbackFrameworkVersion = "v0.0.0"

FallbackFrameworkVersion is written into a generated go.mod when the CLI cannot report a version that the module proxy could resolve — a `go run ./cmd/gombit` or a plain source build, which report DevVersion.

It is deliberately unresolvable: a generated app pinned to it does not build until the user adds a replace directive pointing at a framework checkout. That is the correct outcome for a source build, since the whole point is to develop against local framework changes.

Variables

This section is empty.

Functions

func Generate

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

Generate scaffolds a new Gombit application into opts.Dest (or <workdir>/<name>).

func ResolveFrameworkVersion

func ResolveFrameworkVersion(version string) (resolved string, reason string)

ResolveFrameworkVersion converts the running CLI's version into the version a generated go.mod should require.

A version that the proxy can resolve is used as-is. Anything else — the "dev" sentinel, an empty string, or a v2+ version that the framework's module path could not satisfy — falls back to FallbackFrameworkVersion, and reason explains why for the caller to surface.

Types

type Options

type Options struct {
	Name     string
	Module   string
	Database string
	Cache    string
	Auth     string
	UI       string
	// FrameworkVersion is the gombit version the generated go.mod requires.
	// Empty means derive it from the running CLI; see ResolveFrameworkVersion.
	FrameworkVersion string
	// Tidy runs `go mod tidy` in the generated tree so it builds without
	// further steps. It reaches the network, so it is opt-in: the CLI enables
	// it, library callers and tests do not.
	Tidy    bool
	WorkDir string
	Dest    string
	DryRun  bool
	Force   bool

	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
	IsTTY  func() bool
	// contains filtered or unexported fields
}

Options configures application scaffolding.

Jump to

Keyboard shortcuts

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