# Local SDK Development

This guide explains how to run the RealtimeCursor SDK locally for development purposes.

## Running the SDK Locally

To run the SDK locally without TypeScript errors, use the provided script:

```bash
./run-local.sh
```

This script will:
1. Clean up any previous build
2. Install dependencies if needed
3. Copy the source files to the `dist` directory without TypeScript compilation
4. Create a package.json file in the `dist` directory

## Using the Local SDK in the Application

To use the local SDK in the application, you can import it directly from the `dist` directory:

```jsx
import { RealtimeCursor } from '../../sdk/dist/realtimecursor';
import { useRealtimeCursor } from '../../sdk/dist/useRealtimeCursor';
import { CursorOverlay } from '../../sdk/dist/CursorComponents';
import '../../sdk/dist/cursor.css';
```

## Running the Application with the Local SDK

To run the entire application with the local SDK, use the provided script:

```bash
./run-with-local-sdk.sh
```

This script will:
1. Build the SDK locally
2. Start the backend server
3. Start the frontend server

## Building the SDK for Production

To build the SDK for production, use the provided build script:

```bash
npm run build
```

This will:
1. Run the TypeScript compiler
2. Create the necessary files in the `dist` directory
3. Generate the type definitions

## Publishing the SDK

To publish the SDK to npm, use the provided publish script:

```bash
./publish.sh
```

This will:
1. Build the SDK
2. Publish it to npm

## Troubleshooting

If you encounter TypeScript errors, you can:

1. Use the `run-local.sh` script to bypass TypeScript compilation
2. Update the `tsconfig.json` file to be less strict
3. Fix the TypeScript errors in the source files