eject

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 6 Imported by: 0 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

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