Skip to content

Commit

Permalink
fix(Engine Commands) Pass JSON File to Query Engin (#841)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamluke4 authored and timsuchanek committed Nov 7, 2019
1 parent 22b8749 commit 4777561
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cli/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"execa": "^2.0.5",
"flat-map-polyfill": "^0.3.8",
"p-map": "^3.0.0",
"prisma-datamodel": "1.36.0-test.2"
"prisma-datamodel": "1.36.0-test.2",
"temp-write": "^4.0.0"
},
"husky": {
"hooks": {
Expand Down
9 changes: 4 additions & 5 deletions cli/sdk/src/engineCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import execa from 'execa'
import path from 'path'
import { ConfigMetaFormat } from './isdlToDatamodel2'
import { DMMF } from '@prisma/generator-helper'
import tmpWrite from 'temp-write'

async function getPrismaPath(): Promise<string> {
// tslint:disable-next-line
Expand Down Expand Up @@ -113,14 +114,12 @@ export async function dmmfToDml(
prismaPath?: string,
): Promise<string> {
prismaPath = prismaPath || (await getPrismaPath())
const transformed = {
config: input.config,
dmmf: JSON.stringify(input.dmmf),
}

const filePath = tmpWrite.sync(JSON.stringify(input))
try {
const result = await execa(
prismaPath,
['cli', '--dmmf_to_dml', JSON.stringify(transformed)],
['cli', '--dmmf_file_to_dml', filePath],
{
env: {
...process.env,
Expand Down

0 comments on commit 4777561

Please sign in to comment.