watcher

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WatchDirs = []string{
	"app/http/controllers",
	"app/http/middleware",
	"app/http/requests",
	"app/models",
	"database/migrations",
	"routes",
	"config",
}

WatchDirs are the directories pickle watches for changes (Laravel layout).

Functions

func Watch

func Watch(projectDir string, onChange OnChange) error

Watch monitors a project directory for changes to controllers, migrations, requests, middleware, and routes.go. It calls onChange after a debounce period when changes are detected. Watch blocks until ctx is cancelled or an unrecoverable error occurs.

func WatchDirsForServices

func WatchDirsForServices(serviceDirs []string) []string

WatchDirsForServices returns the watch directories for a multi-service project. serviceDirs are relative paths like "services/api", "services/worker".

func WatchMonorepo

func WatchMonorepo(rootDir string, apps []AppWatchConfig, onChange func(appName string, changed []string)) error

WatchMonorepo monitors multiple apps for changes. When a shared migration directory changes, all apps referencing it are regenerated. When an app-specific directory changes, only that app is regenerated.

func WatchWithDirs

func WatchWithDirs(projectDir string, dirs []string, onChange OnChange) error

WatchWithDirs monitors specific directories for changes. Like Watch but accepts a custom list of relative directories instead of using WatchDirs.

Types

type AppWatchConfig

type AppWatchConfig struct {
	Name          string
	ProjectDir    string
	MigrationDirs []string // absolute paths to all migration dirs (including shared)
}

AppWatchConfig describes an app's directories for monorepo watching.

type OnChange

type OnChange func(changed []string)

OnChange is called when relevant files change. The argument is a list of changed paths (deduplicated over the debounce window).

Jump to

Keyboard shortcuts

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