> ## Documentation Index
> Fetch the complete documentation index at: https://cli.soralabs.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# build

> Compile and package local components into production-ready registry JSON artifacts

The `build` command compiles local component source files into a shadcn-compatible JSON registry distribution. It automatically validates definitions, reads component code from disk, embeds source contents into registry schemas, and outputs individual component JSON files alongside a catalog index.

## Usage

```bash theme={null}
npx @soralabs/cli build [registry-file] [options]
```

Or using the `registry` namespace alias:

```bash theme={null}
npx @soralabs/cli registry build [registry-file] [options]
```

### Quick Examples

```bash Default Registry Build theme={null}
npx @soralabs/cli build
```

```bash Custom Output Directory theme={null}
npx @soralabs/cli build -o dist/r
```

```bash Custom Registry File theme={null}
npx @soralabs/cli build my-registry.json --output public/r
```

```bash Monorepo Workspace theme={null}
npx @soralabs/cli build --cwd packages/ui
```

***

## What It Produces

When executed, `build` generates:

1. **Component Artifacts (`[name].json`)**:
   For each item defined in `registry.json`, an individual JSON schema file is generated under `--output` containing:
   * Metadata (`name`, `type`, `title`, `description`).
   * Declared `dependencies`, `devDependencies`, and `registryDependencies`.
   * Embedded file contents (`files: [{ path, content, target, type }]`).
   * CSS payloads and variable definitions (`css`, `cssVars`).

2. **Catalog Index (`registry.json`)**:
   A top-level registry catalog placed at the root of the output directory containing metadata and summaries for all components, ready to be hosted as a public registry endpoint.

***

## Options

### `--output, -o <path>`

Destination directory where JSON distribution files will be generated.
*(Default: `public/r`)*

### `--cwd, -c <path>`

Root working directory to resolve relative file paths against.


## Related topics

- [add](https://cli.soralabs.studio/commands/add.md)
- [Introduction](https://cli.soralabs.studio/index.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.