action

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: MIT Imports: 36 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TypeAudit    = Type{Key: "audit", Title: "Audit", Icon: "scale", Description: "Audits the project files, detecting invalid files and empty folders"}
	TypeBuild    = Type{Key: "build", Title: "Build", Icon: "hammer", Description: "Builds the project, many options available"}
	TypeCreate   = Type{Key: "create", Title: "Create", Icon: "folder-plus", Description: "Creates a new project"}
	TypeDebug    = Type{Key: "debug", Title: "Debug", Icon: "bug", Description: "Dumps information about the project"}
	TypeDoctor   = Type{Key: "doctor", Title: "Doctor", Icon: "first-aid", Description: "Makes sure your machine has the required dependencies"}
	TypeGenerate = Type{Key: "generate", Title: "Generate", Icon: "forward", Description: "Applies pending changes to files as required"}
	TypePreview  = Type{Key: "preview", Title: "Preview", Icon: "play", Description: "Shows what would happen if you generate"}
	TypeRules    = Type{Key: "rules", Title: "Rules", Icon: "play", Description: "Apply export rules from json file located at ./rules.json"}
	TypeSVG      = Type{Key: "svg", Title: "SVG", Icon: "icons", Description: "Builds the project's SVG files"}
	TypeTest     = Type{Key: "test", Title: "Test", Icon: "wrench", Description: "Runs internal tests, you probably don't want this", Hidden: true}
)
View Source
var AllBuilds = Builds{
	buildFull, buildBuild, buildStart, buildClean, buildDeps, buildImports, buildIgnored, buildPackages, buildCleanup,
	buildTidy, buildFormat, buildLint, buildTemplates, buildClientInstall, buildClientBuild, buildDeployments, buildTest,
}

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(ctx context.Context, pm *PrjAndMods, ret *Result) *Result `json:"-"`
}

type Builds

type Builds []*Build

func (Builds) ForAllProjects added in v1.2.19

func (b Builds) ForAllProjects() Builds

func (Builds) Get

func (b Builds) Get(key string) *Build

type Params

type Params struct {
	ProjectKey string
	T          Type
	Cfg        util.ValueMap
	RootFiles  filesystem.FileLoader
	MSvc       *module.Service
	PSvc       *project.Service
	XSvc       *exec.Service
	SSvc       *websocket.Service
	ESvc       *export.Service
	CLI        bool
	Logger     util.Logger
}

type PrjAndMods

type PrjAndMods struct {
	Cfg    util.ValueMap
	Prj    *project.Project
	FS     filesystem.FileLoader
	File   json.RawMessage
	Mods   module.Modules
	MSvc   *module.Service
	PSvc   *project.Service
	XSvc   *exec.Service
	SSvc   *websocket.Service
	ESvc   *export.Service
	Logger util.Logger
}

type Result

type Result struct {
	Project  *project.Project `json:"project"`
	Action   Type             `json:"action"`
	Status   string           `json:"status"`
	Args     util.ValueMap    `json:"args,omitempty"`
	Data     any              `json:"data,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) (ret *Result)

func (*Result) AddDebug

func (r *Result) AddDebug(msg string, args ...any)

func (*Result) AddLog

func (r *Result) AddLog(msg string, args ...any)

func (*Result) AddWarn

func (r *Result) AddWarn(msg string, args ...any)

func (*Result) AsError added in v0.9.10

func (r *Result) AsError() error

func (*Result) HasErrors

func (r *Result) HasErrors() bool

func (*Result) Merge

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

func (*Result) StatusLog

func (r *Result) StatusLog() string

func (*Result) Title

func (r *Result) Title() 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

func (*ResultContext) Title

func (c *ResultContext) Title() string

type ResultContexts

type ResultContexts []*ResultContext

func ApplyAll

func ApplyAll(ctx context.Context, prjs project.Projects, actT Type, cfg util.ValueMap, as *app.State, logger util.Logger) ResultContexts

func (ResultContexts) Errors

func (x ResultContexts) Errors() []string

func (ResultContexts) Title

func (x ResultContexts) Title() 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) Breadcrumb added in v1.5.0

func (t *Type) Breadcrumb() string

func (*Type) Expensive added in v0.10.7

func (t *Type) Expensive(cfg util.ValueMap) bool

func (*Type) MarshalJSON

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

func (*Type) Matches added in v1.2.16

func (t *Type) Matches(x Type) bool

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