From 6ac57bcdaa1289dff5633b74a46df33fb7cdcb13 Mon Sep 17 00:00:00 2001 From: Shane <12244245+shane-js@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:48:38 -0400 Subject: [PATCH 1/2] docs: list current cli args Inspired by conversation inside: https://github.com/RobinBlomberg/kysely-codegen/issues/7 --- README.md | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 51f61d0..b30752f 100644 --- a/README.md +++ b/README.md @@ -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) @@ -100,8 +112,20 @@ 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 @@ -119,10 +143,45 @@ 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)) -## Help +### schema +`--schema [value]` +Set the default schema of the database connection. -For more options, run `kysely-codegen --help`. +### verify +`--verify` +Verify that the generated types are up-to-date. (default: false) ## Using the type definitions From 2c581844bce32faa4cf18bddec9c183f904aca7f Mon Sep 17 00:00:00 2001 From: Shane <12244245+shane-js@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:53:17 -0400 Subject: [PATCH 2/2] docs: newlines after cli arg demostrations --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index b30752f..d7e3e1b 100644 --- a/README.md +++ b/README.md @@ -115,14 +115,17 @@ export interface DB { ## 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 @@ -145,42 +148,52 @@ 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. ### verify `--verify` + Verify that the generated types are up-to-date. (default: false) ## Using the type definitions