Skip to content

Commit 72b3add

Browse files
committedNov 16, 2023
Add config file patterns for codegen plugin (resolves #348)
1 parent b1cd3da commit 72b3add

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed
 

‎src/plugins/graphql-codegen/README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ or `devDependencies`:
1212
```json
1313
{
1414
"graphql-codegen": {
15-
"config": ["codegen.{ts,js,json,yml,mjs,cts}", "package.json"]
15+
"config": [
16+
"codegen.{json,yml,yaml,js,ts,mjs,cts}",
17+
".codegenrc.{json,yml,yaml,js,ts}",
18+
"codegen.config.js",
19+
"package.json"
20+
]
1621
}
1722
}
1823
```

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

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

77
// https://the-guild.dev/graphql/codegen/docs/config-reference/codegen-config
8+
// https://github.com/dotansimha/graphql-code-generator/blob/master/packages/graphql-codegen-cli/src/config.ts
89

910
export const NAME = 'GraphQL Codegen';
1011

@@ -15,7 +16,12 @@ export const PACKAGE_JSON_PATH = 'codegen';
1516

1617
export const isEnabled: IsPluginEnabledCallback = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
1718

18-
export const CONFIG_FILE_PATTERNS = ['codegen.{ts,js,json,yml,mjs,cts}', 'package.json'];
19+
export const CONFIG_FILE_PATTERNS = [
20+
'codegen.{json,yml,yaml,js,ts,mjs,cts}',
21+
'.codegenrc.{json,yml,yaml,js,ts}',
22+
'codegen.config.js',
23+
'package.json',
24+
];
1925

2026
const findPluginDependencies: GenericPluginCallback = async (configFilePath, options) => {
2127
const { manifest, isProduction } = options;

0 commit comments

Comments
 (0)
Please sign in to comment.