Skip to content

Commit 8d9ee61

Browse files
committedOct 29, 2023
Housekeeping graphql-codegen plugin
1 parent e5b0fed commit 8d9ee61

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed
 

‎src/plugins/graphql-codegen/index.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { isConfigurationOutput } from './types.js';
44
import type { ConfiguredPlugin, GraphqlCodegenTypes, PresetNames } from './types.js';
55
import type { IsPluginEnabledCallback, GenericPluginCallback } from '../../types/plugins.js';
66

7-
export const NAME = 'Graphql Codegen';
7+
// https://the-guild.dev/graphql/codegen/docs/config-reference/codegen-config
8+
9+
export const NAME = 'GraphQL Codegen';
810

911
/** @public */
1012
export const ENABLERS = [/^@graphql-codegen\//];
@@ -20,8 +22,6 @@ const findPluginDependencies: GenericPluginCallback = async (configFilePath, opt
2022

2123
if (isProduction) return [];
2224

23-
// load configuration file from `configFilePath` (or grab `manifest` for package.json)
24-
// load(FAKE_PATH) will return `undefined`
2525
const localConfig: GraphqlCodegenTypes | undefined = configFilePath.endsWith('package.json')
2626
? manifest[PACKAGE_JSON_PATH]
2727
: await load(configFilePath);
@@ -39,13 +39,11 @@ const findPluginDependencies: GenericPluginCallback = async (configFilePath, opt
3939

4040
const flatPlugins = generateSet
4141
.filter((config): config is ConfiguredPlugin => !isConfigurationOutput(config))
42-
.map(item => Object.keys(item))
43-
.flat()
42+
.flatMap(item => Object.keys(item))
4443
.map(plugin => `@graphql-codegen/${plugin}`);
4544

4645
const nestedPlugins = configurationOutput
47-
.map(configOutput => (configOutput.plugins ? configOutput.plugins : []))
48-
.flat()
46+
.flatMap(configOutput => (configOutput.plugins ? configOutput.plugins : []))
4947
.map(plugin => `@graphql-codegen/${plugin}`);
5048

5149
return [...presets, ...flatPlugins, ...nestedPlugins];

0 commit comments

Comments
 (0)
Please sign in to comment.