codegen

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package codegen generates the code that connects a Tern app's routes to the runtime: tern.gen.go for the Go server, the client route manifest for Vite, and TypeScript types for every route.

Index

Constants

View Source
const (
	RoutesDir   = "src/routes"
	AppHTML     = "src/app.html"
	GenDir      = ".tern"
	GoFile      = "tern.gen.go"
	ClientEntry = ".tern/generated/client.js"
	ClientOut   = ".tern/output/client"
	ServerEntry = ".tern/generated/server.js"
	ServerOut   = ".tern/output/server"
)

Project layout conventions.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Manifest *routes.Manifest
	// Changed lists the files that were written because their content changed.
	Changed []string
	// GoChanged reports whether Go code changed, so the server must be rebuilt.
	GoChanged bool
	// Prerender reports whether any route is prerendered at build time.
	Prerender bool
}

Result describes what Generate produced.

func Generate

func Generate(root string) (*Result, error)

Generate scans the project at root and writes all generated files. Files whose content is unchanged are not rewritten, so file watchers only see real changes.

Jump to

Keyboard shortcuts

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