diff --git a/src/cli.ts b/src/cli.ts index 9a9bdec..d1d76df 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -35,10 +35,18 @@ import { getProjectContext } from "./get-project-context" "generate", "generate types and sql documentation from database", (yargs) => { - yargs.option("pglite", { type: "boolean", default: false }) + yargs.option("pglite", { + type: "boolean", + default: undefined, + description: "Use PGlite instead of a real PostgreSQL connection. Defaults to the pglite option in pgstrap.config.js if set.", + }) }, async (argv) => { - generate({ ...(await getProjectContext()), pglite: !!argv.pglite }) + const ctx = await getProjectContext() + generate({ + ...ctx, + pglite: argv.pglite ?? ctx.pglite ?? false, + }) }, ) .parse() diff --git a/src/define-config.ts b/src/define-config.ts index 342428c..4fb5dff 100644 --- a/src/define-config.ts +++ b/src/define-config.ts @@ -2,6 +2,9 @@ export interface PgstrapConfig { defaultDatabase: string schemas: string[] + /** Use PGlite instead of a real PostgreSQL connection */ + pglite?: boolean + dbDir?: string }