diff --git a/packages/generator/src/generator.ts b/packages/generator/src/generator.ts index 3737780..b6c99b4 100644 --- a/packages/generator/src/generator.ts +++ b/packages/generator/src/generator.ts @@ -85,8 +85,18 @@ generatorHandler({ function handleFormatting() { const generator = getGenerator() if (generator.config.formatter == null) return - - execSync(`prettier --write ${generator.output.path}`, { stdio: 'inherit' }) + switch (generator.config.formatter) { + case 'prettier': + execSync(`prettier --write ${generator.output.path}`, { + stdio: 'inherit', + }) + break + case 'biome': + execSync(`biome format --write ${generator.output.path}`, { + stdio: 'inherit', + }) + break + } } export function reduceImports(imports: ImportValue[]) { diff --git a/packages/generator/src/lib/config.ts b/packages/generator/src/lib/config.ts index 8c07ca1..4c67dfd 100644 --- a/packages/generator/src/lib/config.ts +++ b/packages/generator/src/lib/config.ts @@ -7,6 +7,7 @@ import { object, optional, safeParse, + union, } from 'valibot' import { DateMode } from '~/shared/date-mode' import { ModuleResolution } from '~/shared/generator-context/module-resolution' @@ -16,7 +17,7 @@ const Config = object({ relationalQuery: withDefault(optional(BooleanInStr), true), moduleResolution: optional(ModuleResolution), verbose: optional(BooleanInStr), - formatter: optional(literal('prettier')), + formatter: optional(union([literal('prettier'), literal('biome')])), dateMode: optional(DateMode), }) export type Config = Output