> ## Documentation Index
> Fetch the complete documentation index at: https://www.lettercamp.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Check before deploying

> Check your publication's imports and run a temporary build before deploying to Lettercamp Cloud, with actionable errors and JSON output for agents.

Run `lettercamp check` after changing components, styles, or articles to find
problems before deploying to Lettercamp Cloud. It checks imports and source files,
then builds a temporary deployment copy without signing in, uploading, or changing
your publication.

```bash theme={null}
npx lettercamp check
```

A successful full check prints:

```text theme={null}
✓ Ready to deploy. Imports are supported and the publication builds.
```

The command exits with code `0` on success and `1` when it finds a problem.
It groups import problems by cause, gives file and line locations, and explains
how to fix them. Fix the reported problems and rerun the command; the build runs
after the import checks pass.

## Options

| Option | Behavior |
| - | - |
| `--json` | Print one JSON result for an agent or script. Exit codes stay the same. |
| `--no-build` | Check imports and source files without rendering the publication. Run a full check before deploying. |

New publications include an `npm run check` script. Existing publications can use
`npx lettercamp check` directly. If the command is missing, [update the CLI](https://www.lettercamp.com/docs/cli/installation.md#update-the-cli).

## Fix an unsupported import

For example, a footer might import its stylesheet through a project alias:

```tsx theme={null}
import styles from '#blog/components/Footer.module.scss';
```

Cloud does not use your publication's `package.json` import aliases. Sass is
supported, so keep the stylesheet and import it relative to the component:

```tsx theme={null}
import styles from './Footer.module.scss';
```

See [supported imports](https://www.lettercamp.com/docs/react-components.md#supported-imports) for the complete
component guidance, including alternatives to icon packages.

## Use with an agent

If the change needs hosted images or fonts, the agent can first
[upload them with the signed-in CLI](https://www.lettercamp.com/docs/cli/upload.md#let-an-agent-upload-assets) and
write the returned URLs into the source. `check` validates the resulting
publication; it does not upload files.

Ask your agent to run this after changing custom components:

```bash theme={null}
npx lettercamp check --json
```

The result contains `ok`, `build` (`passed`, `failed`, or `skipped`), and an
`issues` array. Each issue has a `code` and `message`. When available, it includes
`file`, `line`, `column`, `import`, `fix`, and a suggested `replacement` import.
For example:

```json theme={null}
{
  "ok": false,
  "build": "skipped",
  "issues": [
    {
      "code": "subpath-import",
      "file": "components/Footer.tsx",
      "line": 1,
      "column": 1,
      "import": "#blog/components/Footer.module.css",
      "message": "\"#blog/components/Footer.module.css\" uses a package.json \"imports\" alias. package.json is not part of a deployment, so Lettercamp Cloud cannot resolve the alias.",
      "fix": "Use the relative path \"./Footer.module.css\".",
      "replacement": "./Footer.module.css"
    }
  ]
}
```

An agent should fix the reported files and rerun the full check until `ok` is
`true` and `build` is `passed`. Use [local preview](https://www.lettercamp.com/docs/cli/dev.md) to inspect appearance
and browser interactions too. The check renders the site; it is not a TypeScript
type checker or a browser interaction test.

## Check, build, and deploy

* **`check`** tests compatibility with Cloud using your installed CLI. It removes
  its temporary output when finished. Account and plan-specific limits are
  checked during deployment.
* **[`build`](https://www.lettercamp.com/docs/publishing/build)** writes a static site for another host and can
  use locally installed packages. Passing this build alone does not establish
  Cloud compatibility.
* **[`deploy`](https://www.lettercamp.com/docs/publishing/deploy)** runs the same import and temporary build
  checks before a new upload, then publishes. An interrupted deployment resumes
  its saved snapshot; new edits belong to the next deployment.


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