genart.dev
Developer Mode

Compilation

How developer projects compile to .genart files — bundling, state preservation, and watch mode.

The compiler transforms a developer project directory into a single .genart JSON file.

How It Works

  1. Read sketch.meta.json for metadata
  2. Bundle sketch.js + components/ + lib/ into a single algorithm string
  3. Validate the bundled algorithm against the renderer adapter
  4. Merge with existing .genart state (if preserving)
  5. Write the output .genart file

State Preservation

By default, the compiler preserves state from an existing .genart file at the output path:

  • Parameters — Current values are retained (new params get defaults)
  • Seed — Kept from existing file
  • Layers — Design layer stack is preserved

Disable with --no-preserve-state or --no-preserve-layers.

Watch Mode

genart compile ./my-project --watch

Recompiles on any file change in the project directory. Useful with external preview tools.

Error Handling

If compilation fails (syntax error, invalid metadata), the compiler:

  • Prints the error with source location
  • Keeps the previous .genart file intact
  • In watch mode, waits for the next save to retry