Skip to content

Commit 268bf7e

Browse files
committed
perf(nx-payload): use a more simple solution to analyze config content
closed COD-346
1 parent daa6fb4 commit 268bf7e

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

packages/nx-payload/src/plugins/utils/create-payload-nodes.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { readFile } from 'fs/promises';
12
import { dirname, join, relative } from 'path/posix';
23

34
import {
@@ -13,7 +14,6 @@ import { calculateHashForCreateNodes } from '@nx/devkit/src/utils/calculate-hash
1314
import { getLockFileName } from '@nx/js';
1415

1516
import { createPayloadTargets } from '../../utils/create-payload-targets';
16-
import { extractPayloadConfig } from '../../utils/extract-payload-config';
1717
import { findUpFs } from '../../utils/find-up-fs';
1818

1919
import {
@@ -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 = /graphQL:\s*\{[^}]*disable:\s*true[^}]*\}/.test(
70+
configContent
71+
);
7772

7873
const hash = await calculateHashForCreateNodes(
7974
projectRoot,

0 commit comments

Comments
 (0)