Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstantiateTemplate ¶
InstantiateTemplate clones a git template and turns it into a ready-to-build project named after targetDir's base: it writes a go.mod, rewrites example imports to the module path, and sets world.toml's project field. On any failure the partially-created targetDir is removed so the name stays retryable. All paths are explicit — no os.Chdir.
func Scaffold ¶
func Scaffold(ctx context.Context, tmpl GameTemplate, targetDir string) error
Scaffold creates a new project at targetDir from the given template: it clones and instantiates the template (see InstantiateTemplate) at the World Engine release this binary was built from, then tidies dependencies. It is the single entry point for callers that don't manage the individual steps (e.g. the editor). On any failure it leaves nothing behind — targetDir is removed so the name stays retryable.
Types ¶
type GameTemplate ¶
type GameTemplate struct {
Name string
ShortName string // Short name for CLI flag usage (e.g., "basic", "demo", "bare")
Description string
URL string
Subdir string
}
GameTemplate represents a game template that can be cloned.
func GetAvailableTemplates ¶
func GetAvailableTemplates() []GameTemplate
GetAvailableTemplates returns all available game templates.
func GetTemplateByName ¶
func GetTemplateByName(name string) (*GameTemplate, error)
GetTemplateByName finds a template by its short name (case-insensitive). Returns an error if the template is not found.