@graphql-inspector/cli 3.3.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +41 -3
  2. package/index.js +1 -9
  3. package/index.mjs +1 -9
  4. package/package.json +17 -16
package/README.md CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/%40graphql-inspector%2Fcli.svg)](https://npmjs.com/package/@graphql-inspector/cli)
4
4
 
5
- **GraphQL Inspector** ouputs a list of changes between two GraphQL schemas. Every change is precisely explained and marked as breaking, non-breaking or dangerous.
6
- It helps you validate documents and fragments against a schema and even find similar or duplicated types.
5
+ **GraphQL Inspector** ouputs a list of changes between two GraphQL schemas. Every change is precisely explained and
6
+ marked as breaking, non-breaking or dangerous. It helps you validate documents and fragments against a schema and even
7
+ find similar or duplicated types.
7
8
 
8
9
  ![Example](./demo.gif)
9
10
 
@@ -20,7 +21,8 @@ Major features:
20
21
  - **GitHub Bot**
21
22
  - **GitHub Actions**
22
23
 
23
- GraphQL Inspector has a **CLI** and also a **programatic API**, so you can use it however you want to and even build tools on top of it.
24
+ GraphQL Inspector has a **CLI** and also a **programatic API**, so you can use it however you want to and even build
25
+ tools on top of it.
24
26
 
25
27
  ## Installation
26
28
 
@@ -104,6 +106,42 @@ const invalid: InvalidDocument[] = validate(documentsGlob, schema)
104
106
 
105
107
  ![Validate](https://raw.githubusercontent.com/kamilkisiela/graphql-inspector/master/assets/validate.jpg)
106
108
 
109
+ ### Audit documents
110
+
111
+ Audit your documents for useful metrics such as query depth, directive count and alias count.
112
+
113
+ **CLI:**
114
+
115
+ $ graphql-inspector audit DOCUMENTS
116
+
117
+ **API:**
118
+
119
+ Not available
120
+
121
+ ```
122
+ $ yarn graphql-inspector audit "packages/**/*.graphql|packages/**/*.ts(x)"
123
+
124
+ Maximum depth is 16
125
+ Maximum alias amount is 3
126
+ Maximum directive amount is 6
127
+ ```
128
+
129
+ ```
130
+ $ yarn graphql-inspector audit "packages/**/*.graphql|packages/**/*.ts(x)" --detail
131
+
132
+ ┌────────────────┬───────┬─────────┬────────────┐
133
+ │ Operation Name │ Depth │ Aliases │ Directives │
134
+ ├────────────────┼───────┼─────────┼────────────┤
135
+ │ getFoo │ 1 │ 2 │ 6 │
136
+ ├────────────────┼───────┼─────────┼────────────┤
137
+ │ getBar │ 16 │ 3 │ 0 │
138
+ └────────────────┴───────┴─────────┴────────────┘
139
+
140
+ Maximum depth is 16
141
+ Maximum alias amount is 3
142
+ Maximum directive amount is 6
143
+ ```
144
+
107
145
  ### Serve faked GraphQL API
108
146
 
109
147
  Serves a GraphQL server with faked data and GraphQL Playground
package/index.js CHANGED
@@ -12,15 +12,7 @@ function main() {
12
12
  return tslib.__awaiter(this, void 0, void 0, function* () {
13
13
  const config = {
14
14
  loaders: ['code', 'git', 'github', 'graphql', 'json', 'url'],
15
- commands: [
16
- 'docs',
17
- 'serve',
18
- 'diff',
19
- 'validate',
20
- 'coverage',
21
- 'introspect',
22
- 'similar',
23
- ],
15
+ commands: ['docs', 'serve', 'diff', 'validate', 'coverage', 'introspect', 'similar', 'audit'],
24
16
  };
25
17
  const loaders$1 = loaders.useLoaders(config);
26
18
  const commands$1 = commands.useCommands({ config, loaders: loaders$1 });
package/index.mjs CHANGED
@@ -7,15 +7,7 @@ function main() {
7
7
  return __awaiter(this, void 0, void 0, function* () {
8
8
  const config = {
9
9
  loaders: ['code', 'git', 'github', 'graphql', 'json', 'url'],
10
- commands: [
11
- 'docs',
12
- 'serve',
13
- 'diff',
14
- 'validate',
15
- 'coverage',
16
- 'introspect',
17
- 'similar',
18
- ],
10
+ commands: ['docs', 'serve', 'diff', 'validate', 'coverage', 'introspect', 'similar', 'audit'],
19
11
  };
20
12
  const loaders = useLoaders(config);
21
13
  const commands = useCommands({ config, loaders });
package/package.json CHANGED
@@ -1,27 +1,28 @@
1
1
  {
2
2
  "name": "@graphql-inspector/cli",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "Tooling for GraphQL. Compare GraphQL Schemas, check documents, find breaking changes, find similar types.",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
7
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
8
8
  },
9
9
  "dependencies": {
10
- "@graphql-inspector/code-loader": "3.3.0",
11
- "@graphql-inspector/commands": "3.3.0",
12
- "@graphql-inspector/coverage-command": "3.3.0",
13
- "@graphql-inspector/diff-command": "3.3.0",
14
- "@graphql-inspector/docs-command": "3.3.0",
15
- "@graphql-inspector/git-loader": "3.3.0",
16
- "@graphql-inspector/github-loader": "3.3.0",
17
- "@graphql-inspector/graphql-loader": "3.3.0",
18
- "@graphql-inspector/introspect-command": "3.3.0",
19
- "@graphql-inspector/json-loader": "3.3.0",
20
- "@graphql-inspector/loaders": "3.3.0",
21
- "@graphql-inspector/serve-command": "3.3.0",
22
- "@graphql-inspector/similar-command": "3.3.0",
23
- "@graphql-inspector/url-loader": "3.3.0",
24
- "@graphql-inspector/validate-command": "3.3.0",
10
+ "@graphql-inspector/audit-command": "3.4.0",
11
+ "@graphql-inspector/code-loader": "3.4.0",
12
+ "@graphql-inspector/commands": "3.4.0",
13
+ "@graphql-inspector/coverage-command": "3.4.0",
14
+ "@graphql-inspector/diff-command": "3.4.0",
15
+ "@graphql-inspector/docs-command": "3.4.0",
16
+ "@graphql-inspector/git-loader": "3.4.0",
17
+ "@graphql-inspector/github-loader": "3.4.0",
18
+ "@graphql-inspector/graphql-loader": "3.4.0",
19
+ "@graphql-inspector/introspect-command": "3.4.0",
20
+ "@graphql-inspector/json-loader": "3.4.0",
21
+ "@graphql-inspector/loaders": "3.4.0",
22
+ "@graphql-inspector/serve-command": "3.4.0",
23
+ "@graphql-inspector/similar-command": "3.4.0",
24
+ "@graphql-inspector/url-loader": "3.4.0",
25
+ "@graphql-inspector/validate-command": "3.4.0",
25
26
  "tslib": "^2.0.0",
26
27
  "yargs": "17.2.1"
27
28
  },