Skip to content

watcher

kind: watcher
name: schema
spec:
prefix: packages/schema
include: ["**/*.graphql"]
exclude: ["**/generated/**"]
---
kind: process
name: codegen
spec:
cmd: pnpm
args: [codegen]
env:
SCHEMA_REVISION: ${ watcher.schema.status.revision }

A file set is shared by watcher and a process’s watch:

field default
include globs of files to follow []
exclude globs to leave out []
prefix the directory the globs are relative to, itself relative to the workspace root the root

File sets are followed through watchman.

{ "revision": "8c1f…", "files": 42 }

revision is a hash of the set’s file list and contents; files is the count. Reading revision from another resource makes that resource re-render whenever a watched file changes, so the codegen process above restarts with every schema edit. A process that should simply restart on its own source changes uses its watch field instead.