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.
View Source
const ConfigFile = "tern.json"
ConfigFile is the optional project configuration, shared by the code generator, the Vite plugin and the runtime.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v1.0.0
type Config struct {
// BasePath serves the app under a URL prefix such as "/app". It must
// start with a slash and must not end with one. The default is "".
BasePath string `json:"basePath"`
}
Config is the contents of tern.json.
func LoadConfig ¶ added in v1.0.0
LoadConfig reads tern.json from root. A missing file is an empty config.
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.
Click to show internal directories.
Click to hide internal directories.