

This guide explains how to develop **Cubitt Components** locally (inside the Cubitt monorepo) while having **Mobius** automatically use your local changes.

<Callout type="info">
  Cubitt uses **Bun** while Mobius uses **pnpm**. Since each package manager has its own link registry, we use path-based overrides instead of `link` commands.
</Callout>

## Instructions [#instructions]

<Steps>
  <Step>
    ### Add override in Mobius [#add-override-in-mobius]

    Add a pnpm override to the **Mobius root** `package.json`:

    ```jsonc title="package.json"
    {
      "pnpm": {
        "overrides": {
          "@tilt-legal/cubitt-components": "link:../cubitt/packages/components"
        }
      }
    }
    ```

    Then install:

    ```bash title="Mobius repo"
    cd ~/tilt-legal/mobius
    pnpm install
    ```

    <Callout type="info">
      This override forces **every package in Mobius** to use your local Cubitt Components package, even if they reference it via `catalog:`.
    </Callout>
  </Step>

  <Step>
    ### Enable live updates [#enable-live-updates]

    Cubitt exports TypeScript source files during development. To get live updates without rebuilding, add Cubitt to the `transpilePackages` array in Mobius's Next.js config:

    ```typescript title="apps/app/next.config.ts"
    const nextConfig: NextConfig = {
      transpilePackages: [
        "@mobius/queries",
        "@mobius/collections",
        "@tilt-legal/cubitt-components", // Add for live updates
      ],
    };
    ```

    <Callout type="info">
      This config can stay permanently. When Cubitt is installed normally (pre-built from npm), Next.js simply passes the compiled JS through without issue.
    </Callout>
  </Step>

  <Step>
    ### Run both in dev mode [#run-both-in-dev-mode]

    Start Cubitt:

    ```bash title="Cubitt repo"
    cd ~/tilt-legal/cubitt
    turbo dev
    ```

    Start Mobius:

    ```bash title="Mobius repo"
    cd ~/tilt-legal/mobius
    turbo dev
    ```

    With `transpilePackages` configured, changes to Cubitt components will be picked up by Mobius automatically.
  </Step>
</Steps>

## Verifying the link [#verifying-the-link]

### Check resolution [#check-resolution]

```bash
pnpm why @tilt-legal/cubitt-components
```

Should show:

```
link:../cubitt/packages/components
```

### Inspect node\_modules [#inspect-node_modules]

```bash
ls -la node_modules/@tilt-legal/cubitt-components
```

Should be a symlink pointing to your local Cubitt directory.

## Removing the local link [#removing-the-local-link]

To revert to the published npm version via catalog, remove the override from Mobius root `package.json`, then reinstall:

```bash title="Mobius repo"
cd ~/tilt-legal/mobius
pnpm install
```
