Skip to content

Commit

Permalink
Add config option for disabling output formatting (#2074)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvestergaard authored and dotansimha committed Jul 3, 2019
1 parent cd55640 commit b5f7fb3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/getting-started/codegen-config.md
Expand Up @@ -48,7 +48,9 @@ Here are the supported options that you can define in the config file (see [sour
- [**`config`**](./config-field#root-level) - Options that we would like to provide to the specified plug-ins. The options may vary depends on what plug-ins you specified. Read the documentation of that specific plug-in for more information. [You can read more about how to pass configuration to plugins here](./config-field)

- **`overwrite`** - A flag to overwrite files in case they're already exist when generating code (`true` by default)
-

- **`prettify`** - A flag that enables formatting of generated code (using [`prettier`](https://prettier.io/)) (`true` by default)

- **`watch`** - A flag to watch for changes in the specified GraphQL schemas and re-generate code any that happens. You can either specify a boolean to turn it on/off, or specify an array of glob patterns to add custom files to the watch.

- **`silent`** - A flag to not print errors in case they occur.
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-codegen-cli/src/codegen.ts
Expand Up @@ -244,7 +244,7 @@ export async function executeCodegen(config: Types.Config): Promise<Types.FileOu
const output = await codegen(outputArgs);
result.push({
filename: outputArgs.filename,
content: await prettify(outputArgs.filename, output),
content: config.prettify === undefined || config.prettify ? await prettify(outputArgs.filename, output) : output,
});
};

Expand Down
1 change: 1 addition & 0 deletions packages/utils/plugins-helpers/src/types.ts
Expand Up @@ -91,6 +91,7 @@ export namespace Types {
config?: { [key: string]: any };
generates: { [output: string]: OutputConfig | ConfiguredOutput };
overwrite?: boolean;
prettify?: boolean;
watch?: boolean | string | string[];
silent?: boolean;
pluginLoader?: PackageLoaderFn<CodegenPlugin>;
Expand Down

0 comments on commit b5f7fb3

Please sign in to comment.