Skip to content

Commit

Permalink
fix: Removed unnecessary create enum from input type
Browse files Browse the repository at this point in the history
  • Loading branch information
unlight committed Aug 15, 2020
1 parent c1fbaf6 commit e6774ab
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
9 changes: 0 additions & 9 deletions src/create-enum.ts

This file was deleted.

8 changes: 1 addition & 7 deletions src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import assert from 'assert';
import { existsSync, promises as fs } from 'fs';
import { Project, QuoteKind, SourceFile } from 'ts-morph';

import { createEnum } from './create-enum';
import { generateEnum } from './generate-enum';
import { FileType, generateFileName } from './generate-file-name';
import { generateInput } from './generate-input';
Expand Down Expand Up @@ -51,12 +50,7 @@ export async function generate(args: GenerateArgs) {
return sourceFile;
};
// Generate enums
const enums = prismaClientDmmf.schema.inputTypes
.flatMap((i) => i.fields)
.flatMap((f) => f.inputType)
.filter((t) => t.kind === 'enum')
.map<PrismaDMMF.Enum>(createEnum)
.concat(prismaClientDmmf.datamodel.enums);
const enums = [...prismaClientDmmf.schema.enums, ...prismaClientDmmf.datamodel.enums];
for (const enumerable of enums) {
const sourceFile = await createSourceFile({ type: 'enum', name: enumerable.name });
generateEnum({ enumerable, sourceFile });
Expand Down

0 comments on commit e6774ab

Please sign in to comment.