Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
graphql-print
Advanced tools
graphql-print
The printer that GraphQL always deserved.
✅ Pretty and minified printing
✅ Print comments
✅ Configure line length
✅ Choose custom indentation
Note that graphql
is a peer dependency of this package and needs to be installed as well.
npm i graphql graphql-print
This package supports printing any valid GraphQL AST node, as well as printing a list of nodes.
By default, the printer outputs a pretty-printed version of the given AST nodes, but it can be configured in different ways. The following table shows the supported options.
Option | Type | Default | Description |
---|---|---|---|
minified | boolean | false | Returns a minified version of the AST, optimizing for shortest string length |
preserveComments | boolean | false | All comments are stripped from the AST by default but can be perserved using this option |
maxLineLength | number | 80 | The printer tries to output lists of nodes in a single line where possible and only breaks lists items into individual lines when they become too long. This option controls the threshold for when a line should be broken up into multiple ones. |
indentationStep | string | " " | By default the printer uses two spaces for indentation, this option allows you to configure that. (Note that passing any characters other than ignored tokens will result in a string that does not represent the original AST anymore and might potentially be invalid.) |
import { parse } from "graphql";
import { print } from "graphql-print";
const ast = parse("query MyQuery { myField(myArg: 42, myOtherArg: null)}");
console.log(print(ast));
/**
* Will print the following:
*
* query MyQuery {
* myField(myArg: 42, myOtherArg: null)
* }
*/
FAQs
Print any GraphQL AST node, pretty or minified, with or without comments
We found that graphql-print demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.