schema-typegen
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -101,4 +101,7 @@ 'use strict' | ||
} | ||
result += generateEnumTypes(opts, enums) | ||
result += '\n' | ||
const enumTypes = generateEnumTypes(opts, enums) | ||
if (enumTypes) { | ||
result += enumTypes | ||
result += '\n' | ||
} | ||
result += generateTableTypes(opts, tables, typeMapping, enums) | ||
@@ -105,0 +108,0 @@ return result |
{ | ||
"name": "schema-typegen", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Generate TypeScript type definitions from database schema", | ||
@@ -5,0 +5,0 @@ "main": "schema-typegen.js", |
@@ -89,4 +89,4 @@ <h1 align="center">Welcome to schema-typegen 👋</h1> | ||
id: number; | ||
name?: string; | ||
state?: UserState; | ||
name: string | null; | ||
state: UserState | null; | ||
is_enabled: boolean; | ||
@@ -105,3 +105,3 @@ } | ||
``` | ||
schema-typegen -o ./entities.ts postgres://$(jq -r '.DB.USERNAME' config.json):$(jq -r '.DB.PASSWORD' config.json)@$(jq -r '.DB.HOST' config.json)$(jq -r '.DB.PORT' config.json)/$(jq -r '.DB.NAME' config.json) | ||
schema-typegen -o ./entities.ts postgres://$(jq -r '.DB.USERNAME' config.json):$(jq -r '.DB.PASSWORD' config.json)@$(jq -r '.DB.HOST' config.json):$(jq -r '.DB.PORT' config.json)/$(jq -r '.DB.NAME' config.json) | ||
``` | ||
@@ -108,0 +108,0 @@ |
@@ -68,3 +68,3 @@ #! /usr/bin/env node | ||
fs.writeFileSync(opts.output, types) | ||
console.log(`Generated types from ${schema.tables.length} tables and ${schema.enums.length} enums`) | ||
console.log(`✔ Generated types from ${schema.tables.length} tables and ${schema.enums.length} enums`) | ||
} else { | ||
@@ -71,0 +71,0 @@ console.log(types) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14896
8
286