@@ -11,15 +11,15 @@ import * as path from 'path'
1111import * as fs from 'fs'
1212
1313export async function patchConfig <
14- T extends GraphQLConfig | GraphQLProjectConfig
14+ T extends GraphQLConfig | GraphQLProjectConfig
1515> ( config : T , cwd ?: string , envVars ?: { [ key : string ] : any } ) : Promise < T > {
1616 config = await patchEndpointsToConfig ( config , cwd , envVars )
1717 config = patchDirectivesToConfig ( config , cwd , envVars )
1818 return config
1919}
2020
2121function patchDirectivesToConfig <
22- T extends GraphQLConfig | GraphQLProjectConfig
22+ T extends GraphQLConfig | GraphQLProjectConfig
2323> ( config : T , cwd ?: string , envVars ?: { [ key : string ] : any } ) : T {
2424 config . config = patchDirectivesToConfigData ( config . config , cwd , envVars )
2525 return config
@@ -38,15 +38,11 @@ function patchDirectivesToConfigData(
3838 if ( ! allExtensions . some ( e => e && e . prisma ) ) {
3939 return config
4040 }
41-
41+
4242 const newConfig = { ...config }
4343
4444 if ( newConfig . extensions ) {
45- set (
46- newConfig ,
47- [ 'extensions' , 'customDirectives' ] ,
48- getCustomDirectives ( ) ,
49- )
45+ set ( newConfig , [ 'extensions' , 'customDirectives' ] , getCustomDirectives ( ) )
5046 }
5147
5248 if ( newConfig . projects ) {
@@ -56,7 +52,7 @@ function patchDirectivesToConfigData(
5652 set (
5753 newConfig ,
5854 [ 'projects' , projectName , 'extensions' , 'customDirectives' ] ,
59- getCustomDirectives ( )
55+ getCustomDirectives ( ) ,
6056 )
6157 }
6258 } )
@@ -75,14 +71,13 @@ export function getCustomDirectives(version?: string) {
7571 'directive @pgRelationTable(table: String!, relationColumn: String!, targetColumn: String!) on FIELD_DEFINITION | SCALAR' ,
7672 'directive @pgTable(name: String!) on FIELD_DEFINITION | SCALAR' ,
7773 'directive @pgColumn(name: String!) on FIELD_DEFINITION | SCALAR' ,
78- 'directive @pgDefault(value: String!) on FIELD_DEFINITION | SCALAR'
79- ] ;
74+ 'directive @pgDefault(value: String!) on FIELD_DEFINITION | SCALAR' ,
75+ ]
8076}
8177
82-
83- // TODO: Deprecate and remove this public API in favor
84- // of patchConfig function in playground and other usages
85- // of this project.
78+ // TODO: Deprecate and remove this public API in favor
79+ // of patchConfig function in playground and other usages
80+ // of this project.
8681export async function patchEndpointsToConfig <
8782 T extends GraphQLConfig | GraphQLProjectConfig
8883> ( config : T , cwd ?: string , envVars ?: { [ key : string ] : any } ) : Promise < T > {
@@ -109,7 +104,7 @@ export async function patchEndpointsToConfigData(
109104 const home = os . homedir ( )
110105
111106 const env = new Environment ( home )
112- await env . load ( { } )
107+ await env . load ( true )
113108
114109 if ( newConfig . extensions && newConfig . extensions . prisma ) {
115110 set (
@@ -158,7 +153,7 @@ export async function makeConfigFromPath(
158153
159154 const home = os . homedir ( )
160155 const env = new Environment ( home )
161- await env . load ( { } )
156+ await env . load ( true )
162157
163158 const definition = new PrismaDefinitionClass ( env , ymlPath , envVars )
164159 await definition . load ( { } )
0 commit comments