Can't generate factories
alexthebake opened this issue · 2 comments
Environment
@mizdra/graphql-codegen-typescript-fabbrica version: 0.5.0
typescript version (optional): 5.4.2
@graphql-codegen/cli version (optional): 5.0.2
@graphql-codegen/typescript version (optional):4.0.6
Summary
The file I'm generating is incomplete (basically empty). It looks like this:
import {
type DefineTypeFactoryInterface,
defineTypeFactory,
} from '@mizdra/graphql-codegen-typescript-fabbrica/helper';
import type {
Maybe,
,
} from './graphql';
export * from '@mizdra/graphql-codegen-typescript-fabbrica/helper';
Step to reproduce
I'm honestly not sure how to provide steps to reproduce. I can provide some context however, if that helps.
I'm using this package in the context of an integration test suite using playwright. The configuration files are very simple:
codegen-config.ts
import type { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
overwrite: true,
schema: "http://127.0.0.1:3000/graphql",
generates: {
"codegen/graphql.ts": {
plugins: ["typescript"],
},
'codegen/fabbrica.ts': {
plugins: ['@mizdra/graphql-codegen-typescript-fabbrica'],
config: {
typesFile: './graphql', // required
},
},
},
};
export default config;
tsconfig.json
{
"compilerOptions": {
"module": "Preserve",
"moduleResolution": "Bundler",
"paths": {
"~*": ["./*"],
"~test-helper": ["utils/testHelper"]
}
},
"include": ["**/*.ts"]
}
I've tried different values for module
and moduleResolution
in tsconfig, as well as changing typesFile
to ./graphql.js
, but so far, no dice. Just to be clear: I am able to generate my types file (in my case graphql.ts
) with the "typescript" plugin, so codegen is working in general.
What did you expect to happen?
I expected it to find all my types and create factories.
What actually happened?
It didn't create any factories ):
Participation
- I am willing to submit a pull request for this issue.
Additional comments
No response
@alexthebake Thanks for submitting the issue!
Please create a project where I can reproduce the issue so that I can investigate the issue.
I recommend using StackBlitz. The following URL is a sample StackBlitz project using graphql-codegen-typescript-fabbrica. Please fork it and try to create a project that can reproduce your issue.
@alexthebake
Please try #82 (comment). If it does not solve, reopen this issue.