templates

package
v3.0.0-alpha2.113 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTemplate

func GenerateTemplate(options *BaseTemplate) error

func Install

func Install(options *flags.Init) error

func IsTypescript

func IsTypescript(name string) bool

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

func NormalizeBinaryName(name string) string

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

func ValidTemplateName(name string) bool

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 FileAssociation struct {
	Ext         string `yaml:"ext"`
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
	IconName    string `yaml:"iconName"`
	Role        string `yaml:"role"`
	MimeType    string `yaml:"mimeType"`
}

type ProtocolConfig

type ProtocolConfig struct {
	Scheme      string `yaml:"scheme"                json:"scheme"`
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
}

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

type TemplateData struct {
	Name        string
	Description string
	FS          fs.FS
}

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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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