# taggor codegen

> Write typed code for the components a site serves, from their manifests: React components (react) or typed tags for Vue templates (vue).

## taggor codegen

Write typed code for the components a site serves, from their manifests: React components (react) or typed tags for Vue templates (vue). With `--check` it writes nothing and fails when the folder is out of date.

```sh title="Usage"
npx taggor codegen <target> [options]
```

| Argument | What it does | Default |
| --- | --- | --- |
| `<target>` | What to write: react (components made with @taggor/react) or vue (typed tags for Vue 3 templates, with @taggor/vue). Required. | - |
| `--site <value>` | The site: its id or either of its site keys (always spelled out). A site key also says the environment. | - |
| `--environment <value>` | The environment whose served versions are read: production (the live website) or staging (the test copy). Required when the site is named by its id; a site key already says which. | - |
| `--dir <value>` | The folder the files go to, e.g. src/taggor (created when missing). Only files taggor codegen wrote are ever replaced or removed there. | - |
| `--check` | Write nothing: exit 5 when the folder is not exactly what would be written now (for a CI job). | - |
| `--force` | Replace a file of yours that sits where a generated file goes. | - |

Also takes the [common options](https://taggor.dev/docs/reference/cli.md#common-options): `--api-url`, `--workspace`, `--verbose`, `--store`, `--json`, `--no-input`.

```sh title="Examples"
npx taggor codegen react --site st_0123456789abcdefghjkmnpqrs --dir src/taggor
```

Exit codes: `0` ok, `1` generic, `2` usage, `3` unauthenticated, `4` not_found, `5` conflict, `7` rate_limited, `8` network, `9` forbidden. [What each code means](https://taggor.dev/docs/reference/cli.md#exit-codes).
