libreload

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 1 Imported by: 9 modules, 16 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.

README

Paketo libreload

This library exists to easily support live reloadable processes for Paketo-style buildpacks built using packit v2.

Detect

Use ShouldEnableLiveReload to decide when to require the necessary dependency.

if shouldEnableReload, err := reload.ShouldEnableLiveReload(); err != nil {
    return packit.DetectResult{}, err
} else if shouldEnableReload {
    requirements = append(requirements, <require your preferred reload implementation such as watchexec>)
}

Build

Use TransformReloadableProcesses to transform the non-reloadable process into a reloadable and non-reloadable process.

if shouldEnableReload, err := reload.ShouldEnableLiveReload(); err != nil {
    return packit.BuildResult{}, err
} else if shouldEnableReload {
    nonReloadableProcess, reloadableProcess := reload.TransformReloadableProcesses(originalProcess, libreload.ReloadableProcessSpec{
        WatchPaths: []string{...},
        Shell: "none",
    })
    processes = append(processes, nonReloadableProcess, reloadableProcess)
} else {
    processes = append(processes, originalProcess)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LiveReloadEnabledEnvVar = "BP_LIVE_RELOAD_ENABLED"

Functions

This section is empty.

Types

type ReloadableProcessSpec

type ReloadableProcessSpec struct {
	WatchPaths     []string
	IgnorePaths    []string
	Shell          string
	VerbosityLevel int
}

type Reloader

type Reloader interface {
	ShouldEnableLiveReload() (bool, error)
	TransformReloadableProcesses(originalProcess packit.Process, spec ReloadableProcessSpec) (nonReloadable packit.Process, reloadable packit.Process)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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