Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config option for disabling output formatting #2074

Merged
merged 1 commit into from Jul 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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