diff --git a/packages/generator/src/lib/config.ts b/packages/generator/src/lib/config.ts index a1f1fbd..0adfe1a 100644 --- a/packages/generator/src/lib/config.ts +++ b/packages/generator/src/lib/config.ts @@ -1,8 +1,8 @@ import type { GeneratorOptions } from '@prisma/generator-helper' import { - flatten, type InferIssue, type InferOutput, + flatten, object, optional, safeParse, @@ -22,7 +22,10 @@ const Config = object({ }) export type Config = InferOutput -type ConfigSchemaIssues = [InferIssue, ...InferIssue[]] +type ConfigSchemaIssues = [ + InferIssue, + ...InferIssue[], +] export function parseConfig(config: GeneratorOptions['generator']['config']) { const parsing = safeParse(Config, config) @@ -31,7 +34,9 @@ export function parseConfig(config: GeneratorOptions['generator']['config']) { } class ConfigError extends Error { - constructor(issues: [InferIssue, ...InferIssue[]]) { + constructor( + issues: [InferIssue, ...InferIssue[]] + ) { super(`[prisma-generator-drizzle] Invalid Config:\n${formatError(issues)}`) this.name = 'ConfigError' } diff --git a/packages/generator/src/lib/valibot-schema.ts b/packages/generator/src/lib/valibot-schema.ts index 30364be..6621f5b 100644 --- a/packages/generator/src/lib/valibot-schema.ts +++ b/packages/generator/src/lib/valibot-schema.ts @@ -1,13 +1,11 @@ import { boolean, pipe, string, union } from 'valibot' -import { - transform, -} from 'valibot' +import { transform } from 'valibot' export const BooleanInStr = pipe( union([string(), boolean()]), - transform(value => { - if (typeof value === 'string') return value.toLowerCase() === 'true'; + transform((value) => { + if (typeof value === 'string') return value.toLowerCase() === 'true' - return value; + return value }) ) diff --git a/packages/generator/src/shared/date-mode.ts b/packages/generator/src/shared/date-mode.ts index c5356e4..3c77817 100644 --- a/packages/generator/src/shared/date-mode.ts +++ b/packages/generator/src/shared/date-mode.ts @@ -3,7 +3,7 @@ import type { ParsableField } from '~/lib/adapter/adapter' import { getDirective } from '~/lib/directive' import { getGenerator } from './generator-context' -export const DateMode = picklist(['string', 'date']); +export const DateMode = picklist(['string', 'date']) export function getDateMode(field: ParsableField) { const directive = getDirective(field, 'drizzle.dateMode')