Documentation
¶
Overview ¶
Package cli holds the commands of the avero binary, S14. The command in cmd/avero is a thin wrapper, so a test drives the commands with no process.
Index ¶
Constants ¶
const EnvFile = ".env"
EnvFile is the file that a person writes beside the application. `avero dev` reads it, so the loop needs no export in the shell.
const ProjectFile = "avero.json"
ProjectFile is the file that states the shape of an application and the entry points of its assets. `avero new` writes it.
Variables ¶
var Version = "dev"
Version is the version of the binary. The release build sets it.
Functions ¶
func GenerateCheck ¶
GenerateCheck proves that every generated file of the application is current. It runs in this process, so the application needs no dependency on the avero binary. The MCP server calls the same function. See S16.
Types ¶
type Project ¶
type Project struct {
// Name is the name of the application.
Name string `json:"name"`
// Shape is ssr, spa or api.
Shape string `json:"shape"`
// Hypermedia is datastar or htmx. An api holds none.
Hypermedia string `json:"hypermedia,omitempty"`
// Assets states the asset pipeline.
Assets ProjectAssets `json:"assets"`
// Migrations is the directory that holds the migration files.
Migrations string `json:"migrations"`
}
Project is the content of avero.json.
func LoadProject ¶
LoadProject reads avero.json from dir.
An absent file gives the defaults, so a command works in a directory that a person wrote by hand. A file that exists states the whole asset pipeline: a member that it does not name is empty, so a project that names no Tailwind input runs no Tailwind.
type ProjectAssets ¶
type ProjectAssets struct {
// Entries names each entry point, relative to the assets directory.
Entries []string `json:"entries"`
// Tier is bundled, node or external.
Tier string `json:"tier,omitempty"`
// Command runs the external bundler of tier 2.
Command []string `json:"command,omitempty"`
// Tailwind states the stylesheet and the pinned version. An empty input
// runs no Tailwind.
Tailwind ProjectTailwind `json:"tailwind"`
}
ProjectAssets states the asset pipeline of one application.
type ProjectTailwind ¶
type ProjectTailwind struct {
// Input is the stylesheet that Tailwind reads.
Input string `json:"input,omitempty"`
// Version is the pinned release of the standalone binary.
Version string `json:"version,omitempty"`
// Asset is the name that the manifest records.
Asset string `json:"asset,omitempty"`
}
ProjectTailwind states the Tailwind build.
type Streams ¶
type Streams struct {
// Out receives the result of a command.
Out io.Writer
// Err receives a fault.
Err io.Writer
// In carries the requests of `avero mcp`. A nil value reads the standard
// input.
In io.Reader
// Dir is the working directory. An empty value is the process
// directory.
Dir string
}
Streams holds the input and the output of one run.