A plugin for graphql-cli that auto-generates GraphQL fragments for each type in your project's schema. Version 1.4.1 is current, with stable release cadence. Key differentiator: generates both standard and no-nesting fragments to avoid recursive spread errors, plus deeply nested fragments when no recursion exists. Integrates with APollo, Prisma, and Graphcool workflows.
npm install graphql-cli-generate-fragmentsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Installs graphql-cli and the plugin globally, then generates GraphQL fragments for a project named 'myProject', outputting to src/generated in .graphql format, saving config.
Use automatically generated NoNesting fragments to avoid recursion, or manually ensure no cyclic references.
Specify --save without argument; it sets to true. For false, omit flag or use --no-save.
Use --generator graphql for GraphQL output or --generator js for JavaScript string constant. Check docs.
Install graphql-cli globally: npm i -g graphql-cli
Use NoNesting fragments in queries; DeepNesting fragments are only safe if schema has no cycles.
npm i -g graphql-cli graphql-cli-generate-fragments
Use the generated UserNoNesting fragment instead of User in nested queries.
Ensure graphql version compatible with graphql-cli (v15 recommended).