Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
fix: Add fragment only mode
Browse files Browse the repository at this point in the history
  • Loading branch information
wtrocki committed Apr 17, 2020
1 parent 44f108d commit c1297e2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/graphback-codegen-client/src/ClientCRUDPlugin.ts
Expand Up @@ -17,6 +17,13 @@ export interface ClientGeneratorPluginConfig {
*/
format: 'ts' | 'graphql' | 'gqlwithfragment'

/**
* Generate only fragments and skip query, mutation and subscription elements
* This can be particulairly usefull when many custom complex queries are needed
* but they still base on autogenerated fragments
*/
fragmentOnly: boolean

/**
* RelativePath for the output files created by generator
*/
Expand Down Expand Up @@ -80,6 +87,15 @@ export class ClientCRUDPlugin extends GraphbackPlugin {
throw new Error("Invalid output format for client plugin");
}

if (this.pluginConfig.fragmentOnly) {
documents = {
fragments: documents.fragments,
queries: [],
mutations:[],
subscriptions: [],
};
}

return documents;
}
}

0 comments on commit c1297e2

Please sign in to comment.