Skip to content

Commit

Permalink
Preset: resolve absolute path (#7055)
Browse files Browse the repository at this point in the history
* include full path

* changeset
  • Loading branch information
staff0rd committed Feb 15, 2022
1 parent eff6d76 commit 1e3d37a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/twenty-boats-pull.md
@@ -0,0 +1,5 @@
---
'@graphql-codegen/cli': patch
---

resolve local presets
8 changes: 7 additions & 1 deletion packages/graphql-codegen-cli/src/presets.ts
@@ -1,10 +1,16 @@
import { DetailedError, Types } from '@graphql-codegen/plugin-helpers';
import { resolve } from 'path';

export async function getPresetByName(
name: string,
loader: Types.PackageLoaderFn<{ preset?: Types.OutputPreset; default?: Types.OutputPreset }>
): Promise<Types.OutputPreset> {
const possibleNames = [`@graphql-codegen/${name}`, `@graphql-codegen/${name}-preset`, name];
const possibleNames = [
`@graphql-codegen/${name}`,
`@graphql-codegen/${name}-preset`,
name,
resolve(process.cwd(), name),
];

for (const moduleName of possibleNames) {
try {
Expand Down

1 comment on commit 1e3d37a

@vercel
Copy link

@vercel vercel bot commented on 1e3d37a Feb 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.