Skip to content
This repository has been archived by the owner on Oct 9, 2022. It is now read-only.

Commit

Permalink
chore: replace outdated @prisma/cli (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
itkach authored Apr 11, 2021
1 parent 8742b26 commit 233f44c
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 203 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"lint": "xo --fix"
},
"dependencies": {
"@prisma/cli": "^2.4.1",
"@prisma/generator-helper": "^2.4.1",
"@prisma/sdk": "^2.4.1",
"prisma": "^2.20.0",
"@prisma/generator-helper": "^2.20.1",
"@prisma/sdk": "^2.20.1",
"arg": "^4.1.3",
"camelcase": "^6.0.0",
"dotenv": "^8.2.0",
Expand Down
8 changes: 4 additions & 4 deletions src/deserializer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {ConnectorType, DataSource, DMMF, EnvValue, GeneratorConfig} from '@prisma/generator-helper/dist';

export interface Field {
kind: DMMF.DatamodelFieldKind | DMMF.FieldKind;
kind: DMMF.FieldKind;
name: string;
isRequired: boolean;
isList: boolean;
Expand Down Expand Up @@ -86,7 +86,7 @@ const handlers = (type, kind) => {

// Handler for Attributes
// https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-schema/data-model#attributes
function handleAttributes(attributes: Attribute, kind: DMMF.DatamodelFieldKind | DMMF.FieldKind, type: string) {
function handleAttributes(attributes: Attribute, kind: DMMF.FieldKind, type: string) {
const {relationFromFields, relationToFields, relationName} = attributes;
if (kind === 'scalar') {
return `${Object.keys(attributes).map(each => handlers(type, kind)[each](attributes[each])).join(' ')}`;
Expand Down Expand Up @@ -183,8 +183,8 @@ function deserializeGenerator(generator: GeneratorConfig) {

return `
generator ${name} {
${handleProvider(provider)}
${handleOutput(output)}
${handleProvider(provider.value)}
${handleOutput(output?.value || null)}
${handleBinaryTargets(binaryTargets)}
}`;
}
Expand Down
Loading

0 comments on commit 233f44c

Please sign in to comment.