scaffold

package
v0.0.0-...-e35ac8e Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// FeatureAliases provides common name associates to their appropriate feature name.
	FeatureAliases = map[string][]string{
		"init": {"make", "git", "legal", "authors"},
		"bin":  {"gobinary", "go", "version"},
	}

	// FilesByFeature contains a map of features to the associated files they render.
	FilesByFeature = map[string][]string{
		"Authors": {
			"AUTHORS.tmpl",
		},
		"Docker": {
			"cmd/{{ .Name }}/docker-compose.yaml.tmpl",
			"cmd/{{ .Name }}/Dockerfile.tmpl",
		},
		"GoBinary": {
			"internal/commands/version.go.tmpl",
			"cmd/{{ .Name }}/main.go.tmpl",
		},
		"GoReleaser": {
			"scripts/dist-go.sh.tmpl",
			".goreleaser.yaml.tmpl",
		},
		"Go": {
			"go.mod.tmpl",
		},
		"Version": {
			"package.json.tmpl",
		},
		"Legal": {
			"legal/header.txt.tmpl",
			"LICENSE.tmpl",
		},
		"Git": {
			".gitignore.tmpl",
			".git/HEAD",
			".git/config",
		},
		"Make": {
			"Makefile.tmpl",
		},
	}
)

Functions

This section is empty.

Types

type Data

type Data struct {
	Name     string   `json:"name"`
	License  string   `json:"license"`
	Features []string `json:"features"`
}

Data defines the information needed to render the template.

type File

type File struct {
	Name     string
	Contents []byte
}

File defines a generic file to render.

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer encapsulates the business logic for rendering template data.

func Template

func Template(data Data) *Renderer

Template returns a new Renderer instance that can be used to render template data based on specified features.

func (*Renderer) Render

func (s *Renderer) Render(ctx context.Context) []File

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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