Home / Function/ startWatcher() — ui Function Reference

startWatcher() — ui Function Reference

Architecture documentation for the startWatcher() function in build-icons.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  5d91f7d5_e14c_f16c_793e_f4d1f7131132["startWatcher()"]
  2f008c94_8a17_fd88_024f_322b76e3544a["build-icons.ts"]
  5d91f7d5_e14c_f16c_793e_f4d1f7131132 -->|defined in| 2f008c94_8a17_fd88_024f_322b76e3544a
  8b6df75e_d1fe_5f84_8bf7_b16b4a70e076["main()"]
  5d91f7d5_e14c_f16c_793e_f4d1f7131132 -->|calls| 8b6df75e_d1fe_5f84_8bf7_b16b4a70e076
  style 5d91f7d5_e14c_f16c_793e_f4d1f7131132 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/scripts/build-icons.ts lines 94–126

  async function startWatcher() {
    const { default: chokidar } = await import("chokidar")

    main()

    const watcher = chokidar.watch(REGISTRY_DIR, {
      ignored: /(^|[/\\])\../,
      persistent: true,
      ignoreInitial: true,
    })

    const rebuild = (filename: string) => {
      if (!filename.endsWith(".tsx")) return

      try {
        main()
      } catch (error) {
        console.error("❌ Icons build failed:", error)
      }
    }

    watcher.on("error", (error) => {
      console.error("❌ Watcher error:", error)
    })

    watcher.on("change", rebuild)
    watcher.on("add", rebuild)

    process.on("SIGINT", async () => {
      await watcher.close()
      process.exit(0)
    })
  }

Subdomains

Calls

Frequently Asked Questions

What does startWatcher() do?
startWatcher() is a function in the ui codebase, defined in apps/v4/scripts/build-icons.ts.
Where is startWatcher() defined?
startWatcher() is defined in apps/v4/scripts/build-icons.ts at line 94.
What does startWatcher() call?
startWatcher() calls 1 function(s): main.

Analyze Your Own Codebase

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

Try Supermodel Free