Documentation
¶
Overview ¶
Package eject provides functionality to eject component source code from the components library to a user's project.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EjectComponent ¶
func EjectComponent(opts EjectOptions) error
EjectComponent copies the full component source to the user's project.
func EjectTemplate ¶
func EjectTemplate(opts EjectTemplateOptions) error
EjectTemplate copies only the template file to the user's project.
func GetModuleName ¶
GetModuleName attempts to get the current Go module name from go.mod.
Types ¶
type ComponentInfo ¶
type ComponentInfo struct {
Name string
Package string // e.g., "github.com/livetemplate/lvt/components/dropdown"
Description string
Templates []string
}
ComponentInfo holds information about an ejectable component.
func AvailableComponents ¶
func AvailableComponents() []ComponentInfo
AvailableComponents returns the list of components that can be ejected. Each component's Templates come from the template files the component embeds, so the list cannot drift from what the component ships.
func FindComponent ¶
func FindComponent(name string) *ComponentInfo
FindComponent returns component info by name, or nil if not found.
type EjectOptions ¶
type EjectOptions struct {
// ComponentName is the name of the component to eject.
ComponentName string
// DestDir is the destination directory (default: internal/components/<name>).
DestDir string
// ModuleName is the current project's Go module name.
ModuleName string
// Force overwrites existing files.
Force bool
}
EjectOptions configures the eject operation.
type EjectTemplateOptions ¶
type EjectTemplateOptions struct {
// ComponentName is the name of the component.
ComponentName string
// TemplateName is the template variant to eject.
TemplateName string
// DestDir is the destination directory (default: internal/templates).
DestDir string
// Force overwrites existing files.
Force bool
}
EjectTemplateOptions configures template-only ejection.