Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: list current cli args #167

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 77 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,20 @@

- [Installation](#installation)
- [Generating type definitions](#generating-type-definitions)
- [Include/exclude patterns](#includeexclude-patterns)
- [Help](#help)
- [CLI Arguments](#cli-arguments)
- [camel-case](#camel-case)
- [dialect](#dialect)
- [Include/exclude patterns](#includeexclude-patterns)
- [help](#help)
- [log-level](#log-level)
- [no-domains](#no-domains)
- [out-file](#out-file)
- [print](#print)
- [runtime-enums](#runtime-enums)
- [type-only-imports](#type-only-imports)
- [url](#url)
- [schema](#schema)
- [verify](#verify)
- [Using the type definitions](#using-the-type-definitions)
- [Issue funding](#issue-funding)

Expand Down Expand Up @@ -100,8 +112,23 @@ export interface DB {
}
```

## Include/exclude patterns
## CLI Arguments
### camel-case
`--camel-case`

Use the Kysely CamelCasePlugin for generated table column names.

### dialect
`--dialect [value]`

Set the SQL dialect (values: [postgres, mysql, sqlite, mssql, libsql, bun-sqlite]).

### env-file
`--env-file [value]`

Specify the path to an environment file to use.

### Include/exclude patterns
You can choose which tables should be included during code generation by providing a glob pattern to the `--include-pattern` and `--exclude-pattern` flags. We use [micromatch](https://github.com/micromatch/micromatch) under the hood which provides advanced glob support. For instance, if you only want to include your public tables:

```bash
Expand All @@ -119,10 +146,55 @@ Or exclude an entire class of tables:
```bash
kysely-codegen --exclude-pattern="documents.*"
```
### help
`--help` or `--h`

Run for more options.

### log-level
`--log-level [value]`

Set the terminal log level. (values: [debug, info, warn, error, silent], default: warn)

### no-domains
`--no-domains`

Skip generating types for PostgreSQL domains. (default: false)

### out-file
`--out-file [value]`

Set the file build path. (default: `.\node_modules\kysely-codegen\dist\db.d.ts`)

### print
`--print`

Print the generated output to the terminal.

### runtime-enums
`--runtime-enums`

Generate runtime enums instead of string unions.

### type-only-imports
`--type-only-imports`

Generate TypeScript 3.8+ `import type` syntax (default: true).

### url
`--url [value]`

Set the database connection string URL. This may point to an environment variable. (default: env(DATABASE_URL))

### schema
`--schema [value]`

Set the default schema of the database connection.

## Help
### verify
`--verify`

For more options, run `kysely-codegen --help`.
Verify that the generated types are up-to-date. (default: false)

## Using the type definitions

Expand Down