build

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package build provides production build functionality for Vango applications.

This package handles:

  • Go binary compilation with optimizations
  • Thin client JavaScript bundling and minification
  • Tailwind CSS compilation
  • Static asset copying with cache busting
  • Build manifest generation

Usage

builder := build.New(cfg)
result, err := builder.Build(ctx)
if err != nil {
    log.Fatal(err)
}

fmt.Printf("Built in %s\n", result.Duration)
fmt.Printf("Binary: %s\n", result.Binary)
fmt.Printf("Public: %s\n", result.Public)

Output Structure

dist/
├── server              # Go binary
├── public/            # Or custom static dir from vango.json
│   ├── vango.min.js   # Thin client
│   ├── styles.css     # Compiled CSS
│   └── assets/        # Static files with hashes
└── manifest.json      # Asset manifest

Manifest

The manifest maps original asset paths to their hashed versions:

  • Paths under public/js/islands, public/js/wasm, and public/js/hooks are copied without hashing and mapped to themselves.

    { "vango.min.js": "vango.a1b2c3.min.js", "styles.css": "styles.d4e5f6.css", "logo.png": "assets/logo.g7h8i9.png" }

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildMetadata

type BuildMetadata struct {
	BindingsHash string `json:"bindingsHash"`
	SchemaHash   string `json:"schemaHash,omitempty"`
}

BuildMetadata captures deterministic identity metadata embedded into build output.

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder handles production builds.

func New

func New(cfg *config.Config, options Options) *Builder

New creates a new builder.

func (*Builder) Build

func (b *Builder) Build(ctx context.Context) (*Result, error)

Build performs a production build.

func (*Builder) Clean

func (b *Builder) Clean() error

Clean removes the build output directory.

type Options

type Options struct {
	// Minify enables minification.
	Minify bool

	// SourceMaps enables source map generation.
	SourceMaps bool

	// Target is the Go build target (e.g., "linux/amd64").
	Target string

	// LDFlags are linker flags for go build.
	LDFlags string

	// Tags are build tags.
	Tags []string

	// Verbose enables verbose output.
	Verbose bool

	// GoBinaryPath is the resolved Go toolchain binary to invoke for builds.
	GoBinaryPath string

	// OnProgress is called with progress updates.
	OnProgress func(step string)
}

Options configures the builder.

type Result

type Result struct {
	// Duration is how long the build took.
	Duration time.Duration

	// Binary is the path to the compiled Go binary.
	Binary string

	// Public is the path to the public directory.
	Public string

	// Manifest is the asset manifest.
	Manifest map[string]string

	// ClientSize is the size of the thin client in bytes.
	ClientSize int64

	// ClientGzipSize is the gzipped size of the thin client.
	ClientGzipSize int64

	// CSSSize is the size of the CSS in bytes.
	CSSSize int64
}

Result contains the build output.

Jump to

Keyboard shortcuts

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