action

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TypeAudit   = Type{Key: "audit", Title: "Audit", Icon: "star", Description: "Audits the project files"}
	TypeBuild   = Type{Key: "build", Title: "Build", Icon: "star", Description: "Builds the project"}
	TypeCreate  = Type{Key: "create", Title: "Create", Icon: "star", Description: "Creates a new project"}
	TypeDebug   = Type{Key: "debug", Title: "Debug", Icon: "star", Description: "Dumps a ton of information about the project"}
	TypeDoctor  = Type{Key: "doctor", Title: "Doctor", Icon: "star", Description: "Makes sure your machine has the required dependencies"}
	TypeMerge   = Type{Key: "merge", Title: "Merge", Icon: "star", Description: "Merges changed files as required"}
	TypePreview = Type{Key: "preview", Title: "Preview", Icon: "star", Description: "Show what would happen if you did merge"}
	TypeSlam    = Type{Key: "slam", Title: "Slam", Icon: "star", Description: "Slams all files to the target, ignoring changes"}
	TypeSVG     = Type{Key: "svg", Title: "SVG", Icon: "star", Description: "Builds the project's SVG files"}
	TypeTest    = Type{Key: "test", Title: "Test", Icon: "star", Description: "Runs internal tests, you probably don't want this", Hidden: true}
)
View Source
var AllBuilds = Builds{
	simpleBuild("build", "Build", "make build"),
	simpleBuild("clean", "Clean", "make clean"),
	simpleBuild("tidy", "Tidy", "go mod tidy"),
	simpleBuild("format", "Format", "bin/format.sh"),
	simpleBuild("lint", "Lint", "bin/check.sh"),
	{Key: "clientInstall", Title: "Client Install", Description: ciDesc, Run: func(pm *PrjAndMods, ret *Result) *Result {
		return simpleProc("npm install", filepath.Join(pm.Prj.Path, "client"), ret)
	}},
	simpleBuild("clientBuild", "Client Build", "bin/build/client.sh"),
	{Key: "test", Title: "Test", Description: "Does a test", Run: func(pm *PrjAndMods, ret *Result) *Result {
		return simpleProc("ls", pm.Prj.Path, ret)
	}},
}

Functions

This section is empty.

Types

type Build

type Build struct {
	Key         string `json:"key"`
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`

	Run func(pm *PrjAndMods, ret *Result) *Result `json:"-"`
}

type Builds

type Builds []*Build

type Params

type Params struct {
	Span       *telemetry.Span
	ProjectKey string
	T          Type
	Cfg        util.ValueMap
	RootFiles  filesystem.FileLoader
	MSvc       *module.Service
	PSvc       *project.Service
	ESvc       *export.Service
	CLI        bool
	Logger     *zap.SugaredLogger
}

type PrjAndMods

type PrjAndMods struct {
	Ctx    context.Context
	Cfg    util.ValueMap
	Prj    *project.Project
	Mods   module.Modules
	MSvc   *module.Service
	PSvc   *project.Service
	ESvc   *export.Service
	EArgs  *model.Args
	Logger *zap.SugaredLogger
}

type Result

type Result struct {
	Project  *project.Project `json:"project"`
	Status   string           `json:"status"`
	Args     util.ValueMap    `json:"args,omitempty"`
	Modules  module.Results   `json:"modules,omitempty"`
	Logs     []string         `json:"logs,omitempty"`
	Errors   []string         `json:"errors,omitempty"`
	Duration int              `json:"duration,omitempty"`
	// contains filtered or unexported fields
}

func Apply

func Apply(ctx context.Context, p *Params) *Result

func (*Result) AddDebug

func (r *Result) AddDebug(msg string, args ...interface{})

func (*Result) AddLog

func (r *Result) AddLog(msg string, args ...interface{})

func (*Result) AddWarn

func (r *Result) AddWarn(msg string, args ...interface{})

func (*Result) HasErrors

func (r *Result) HasErrors() bool

func (*Result) LogBlock

func (r *Result) LogBlock(delim string) string

func (*Result) Merge

func (r *Result) Merge(tgt *Result) *Result

func (*Result) StatusLog

func (r *Result) StatusLog() string

func (*Result) WithError

func (r *Result) WithError(err error) *Result

type ResultContext

type ResultContext struct {
	Prj *project.Project `json:"prj,omitempty"`
	Cfg util.ValueMap    `json:"cfg,omitempty"`
	Res *Result          `json:"res,omitempty"`
}

func (*ResultContext) Status

func (c *ResultContext) Status() string

type ResultContexts

type ResultContexts []*ResultContext

func (ResultContexts) Errors

func (x ResultContexts) Errors() []string

type Type

type Type struct {
	Key         string
	Title       string
	Icon        string
	Description string
	Hidden      bool
}

func TypeFromString

func TypeFromString(s string) Type

func (*Type) MarshalJSON

func (t *Type) MarshalJSON() ([]byte, error)

func (*Type) String

func (t *Type) String() string

func (*Type) UnmarshalJSON

func (t *Type) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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