File tree Expand file tree Collapse file tree
packages/nx-payload/src/plugins/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { readFile } from 'fs/promises' ;
12import { dirname , join , relative } from 'path/posix' ;
23
34import {
@@ -13,7 +14,6 @@ import { calculateHashForCreateNodes } from '@nx/devkit/src/utils/calculate-hash
1314import { getLockFileName } from '@nx/js' ;
1415
1516import { createPayloadTargets } from '../../utils/create-payload-targets' ;
16- import { extractPayloadConfig } from '../../utils/extract-payload-config' ;
1717import { findUpFs } from '../../utils/find-up-fs' ;
1818
1919import {
@@ -65,15 +65,10 @@ export const createPayloadNodes = async (
6565 readJsonFile < ProjectConfiguration > ( projectJsonPath ) ;
6666
6767 // Get current GraphQL config state
68- const result = extractPayloadConfig ( configRoot , 'graphQL.disable' ) ;
69- if ( ! result . config ) {
70- // Don't throw to prevent messing up the targets
71- console . error ( result . error ) ;
72- console . warn (
73- `Could not extract Payload config from ${ configFilePath } , GraphQL state is not known`
74- ) ;
75- }
76- const isGraphQLDisabled = result ?. config ?. graphQL ?. disable ?? true ;
68+ const configContent = await readFile ( configFilePath , 'utf-8' ) ;
69+ const isGraphQLDisabled = / g r a p h Q L : \s * \{ [ ^ } ] * d i s a b l e : \s * t r u e [ ^ } ] * \} / . test (
70+ configContent
71+ ) ;
7772
7873 const hash = await calculateHashForCreateNodes (
7974 projectRoot ,
You can’t perform that action at this time.
0 commit comments