Skip to content

Commit 32da58f

Browse files
committed
fix(typegen): include schemas cli mode
1 parent 8d53913 commit 32da58f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/server/app.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
DEFAULT_POOL_CONFIG,
55
EXPORT_DOCS,
66
GENERATE_TYPES,
7-
GENERATE_TYPES_EXCLUDED_SCHEMAS,
7+
GENERATE_TYPES_INCLUDED_SCHEMAS,
88
PG_CONNECTION,
99
PG_META_PORT,
1010
PG_META_REQ_HEADER,
@@ -86,7 +86,11 @@ if (EXPORT_DOCS) {
8686

8787
console.log(
8888
applyTypescriptTemplate({
89-
schemas: schemas.filter(({ name }) => !GENERATE_TYPES_EXCLUDED_SCHEMAS.includes(name)),
89+
schemas: schemas.filter(
90+
({ name }) =>
91+
GENERATE_TYPES_INCLUDED_SCHEMAS.length === 0 ||
92+
GENERATE_TYPES_INCLUDED_SCHEMAS.includes(name)
93+
),
9094
tables,
9195
functions,
9296
types,

src/server/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export const PG_CONNECTION =
1717
export const EXPORT_DOCS = process.argv[2] === 'docs' && process.argv[3] === 'export'
1818
export const GENERATE_TYPES =
1919
process.argv[2] === 'gen' && process.argv[3] === 'types' ? process.argv[4] : undefined
20-
export const GENERATE_TYPES_EXCLUDED_SCHEMAS =
21-
GENERATE_TYPES && process.argv[5] === '--exclude-schemas' ? process.argv[6]?.split(',') ?? [] : []
20+
export const GENERATE_TYPES_INCLUDED_SCHEMAS =
21+
GENERATE_TYPES && process.argv[5] === '--include-schemas' ? process.argv[6]?.split(',') ?? [] : []
2222

2323
export const DEFAULT_POOL_CONFIG = { max: 1, connectionTimeoutMillis: PG_CONN_TIMEOUT_SECS * 1000 }
2424
export const PG_META_REQ_HEADER = process.env.PG_META_REQ_HEADER || 'request-id'

0 commit comments

Comments
 (0)