Home / Function/ watcher() — supabase Function Reference

watcher() — supabase Function Reference

Architecture documentation for the watcher() function in watch.mjs from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  cf4375c5_3c1b_2b97_ddee_cc9d1678bff8["watcher()"]
  cb9ba2bc_e611_2a06_d4d9_0c35b6fd25df["getTemplate()"]
  cf4375c5_3c1b_2b97_ddee_cc9d1678bff8 -->|calls| cb9ba2bc_e611_2a06_d4d9_0c35b6fd25df
  style cf4375c5_3c1b_2b97_ddee_cc9d1678bff8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/scripts/troubleshooting/watch.mjs lines 20–38

  .on('add', (path, stats) => {
    if (!stats?.isFile() || basename(path).startsWith('_')) return

    console.log(`File ${path} has been added.`)

    if (stats?.size !== 0) {
      console.log(`File ${path} already has content. Skipping template writing.`)
      return
    }

    try {
      console.log(`Writing template to ${path}...`)
      const fd = openSync(path, 'w')
      writeSync(fd, getTemplate())
      closeSync(fd)
    } catch (err) {
      console.error(`Error writing template to ${path}:`, err)
    }
  })

Subdomains

Frequently Asked Questions

What does watcher() do?
watcher() is a function in the supabase codebase.
What does watcher() call?
watcher() calls 1 function(s): getTemplate.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free