Skip to content

Watcher

[<Class>]
type Watcher =
    new (projectRoot: AbsolutePath, ignoredDirectories: string list, debounce: TimeSpan, onChange: string list -> unit) : Watcher
    member Follow (paths: AbsolutePath list) : unit
    member Start () : unit
AssemblyNacara.Core
ImplementsIDisposable

Watches the project for changes and coalesces them into rebuilds.

Editors write files in bursts, so changes are debounced. Output, obj, bin and every dotted directory - .nacara, .git, the cache a linter keeps - are ignored, or the build would trigger itself forever.

The project is what is watched by default, and Follow adds the files a build said it read from somewhere else - a changelog in a sibling directory, an assembly an API reference is generated from.

Constructors

new (projectRoot: AbsolutePath, ignoredDirectories: string list, debounce: TimeSpan, onChange: string list -> unit) : Watcher

Methods

member Follow (paths: AbsolutePath list) : unit

Also watch these files, wherever they are.

Call it after every build: what a site depends on is only known once it has been built, and it changes when a page does. Paths already under the project are dropped, being watched already, and calling it again with the same files does nothing.

Parameter
pathsFiles a build read from outside the project.
member Start () : unit