Documentation
¶
Index ¶
- func GenerateTemplate(options *BaseTemplate) error
- func Install(options *flags.Init) error
- func IsTypescript(name string) bool
- func NormalizeBinaryName(name string) string
- func ValidTemplateName(name string) bool
- type BaseTemplate
- type FileAssociation
- type ProtocolConfig
- type Template
- type TemplateData
- type TemplateOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateTemplate ¶
func GenerateTemplate(options *BaseTemplate) error
func IsTypescript ¶
IsTypescript reports whether the named template produces a TypeScript project.
Built-in templates declare this explicitly via `typescript:` in their template.yaml (TypeScript now owns the bare framework name, e.g. `react`, while JavaScript variants carry a `-js` suffix, e.g. `react-js`). For local and remote templates that predate the flag we fall back to the historical `-ts` suffix convention so community templates keep working.
func NormalizeBinaryName ¶
NormalizeBinaryName converts a project name into a valid binary/package name: lowercased, with spaces replaced by dashes, and any remaining characters not in [a-z0-9-] replaced by dashes, collapsing runs and trimming edges.
func ValidTemplateName ¶
Types ¶
type BaseTemplate ¶
type BaseTemplate struct {
Name string `json:"name" yaml:"name" description:"The name of the template"`
ShortName string `json:"shortname" yaml:"shortname" description:"The short name of the template"`
Author string `json:"author" yaml:"author" description:"The author of the template"`
Description string `json:"description" yaml:"description" description:"The template description"`
HelpURL string `json:"helpurl" yaml:"helpurl" description:"The help url for the template"`
Version string `json:"version" yaml:"version" description:"The version of the template" default:"v0.0.1"`
WailsVersion uint8 `json:"wailsVersion" yaml:"wailsVersion" description:"The Wails major version this template targets"`
Typescript bool `json:"typescript" yaml:"typescript" description:"Whether the template produces a TypeScript project"`
Dir string `json:"-" yaml:"-" description:"The directory to generate the template" default:"."`
Frontend string `json:"-" yaml:"-" description:"The frontend directory to migrate"`
}
type FileAssociation ¶
type ProtocolConfig ¶
type Template ¶
type Template struct {
BaseTemplate `yaml:",inline"`
// Schema is kept for backwards-compatible reading of legacy template.json files.
// New templates use template.yaml with WailsVersion instead.
Schema uint8 `json:"schema" yaml:"-"`
// Other data
FS fs.FS `json:"-" yaml:"-"`
// contains filtered or unexported fields
}
Template holds data relating to a template including the metadata stored in template.yaml
type TemplateData ¶
func GetDefaultTemplates ¶
func GetDefaultTemplates() []TemplateData
type TemplateOptions ¶
type TemplateOptions struct {
Cls string `description:"A helper for using close template tags safely }}" default:"}}"`
Opn string `description:"A helper for using open template tags safely {{" default:"{{"`
*flags.Init
BinaryName string
LocalModulePath string
UseTypescript bool
UseInterfaces bool
WailsVersion string
}