eject

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 6 Imported by: 0

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

func GetModuleName() (string, error)

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.

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.

Jump to

Keyboard shortcuts

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