utils

package
v0.0.0-...-86dd0aa Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean(path string) error

Clean cleans the directory at path

func CopyAssetToBuild

func CopyAssetToBuild(runtime RuntimeConfig, srcName string) error

func CopyFiles

func CopyFiles(srcPath, dstPath string) error

Copies files and directories from srcPath to dstPath

func GetBasePageFiles

func GetBasePageFiles(runtime RuntimeConfig) []string

GetBasePageFiles returns the list of base page files in the assets directory This is statically defined and does not support subdirectories since these should not change often

func GetComponentFiles

func GetComponentFiles(runtime RuntimeConfig) ([]string, error)

GetComponentFiles returns the list of component files in the assets/components directory

func GetCurrentEasternTime

func GetCurrentEasternTime() string

Returns the current eastern timestamp

func GetCurrentYear

func GetCurrentYear() string

Returns the current year such as "2024"

func GetRepoRoot

func GetRepoRoot() string

GetRepoRoot returns the root directory of the repository. This value is used to enable consistent relative paths for file copying/creating throughout the templating process

func MakePath

func MakePath(path string) string

func Mkdir

func Mkdir(path string) error

Mkdir wrapper for os.MkdirAll

func ReadDir

func ReadDir(path string) ([]string, error)

ReadDir returns the list of files in the directory, including subdirectories starting with path as a relative path from the repo root

func ReadFile

func ReadFile(path string) ([]byte, error)

ReadFile wrapper for os.ReadFile

func SetupBuild

func SetupBuild(runtime RuntimeConfig) error

SetupBuild generates the directories for the output artifacts and puts assets that do not need processing in the build directory; these assets are referred to by the output artifacts

func WriteFile

func WriteFile(path string, b []byte) error

WriteFile wrapper for ioutil.WriteFile

Types

type RuntimeConfig

type RuntimeConfig struct {
	AssetsPath    string
	ConfigsPath   string
	BuildPath     string
	TemplateFuncs template.FuncMap
}

Parameterizes specific values needed to load assets and configuration at runtime

func NewRuntimeConfig

func NewRuntimeConfig() RuntimeConfig

Jump to

Keyboard shortcuts

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