@graphql-inspector/cli 3.3.0 → 3.4.1-alpha-20230111095532-bd016dc8

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 +45 -5
  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
6
+ precisely explained and marked as breaking, non-breaking or dangerous. It helps you validate
7
+ documents and fragments against a schema and even 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
25
+ to and even build tools on top of it.
24
26
 
25
27
  ## Installation
26
28
 
@@ -70,7 +72,8 @@ const similar: SimilarMap = similar(schema, typename, threshold)
70
72
 
71
73
  ### Check coverage
72
74
 
73
- Schema coverage based on documents. Find out how many times types and fields are used in your application.
75
+ Schema coverage based on documents. Find out how many times types and fields are used in your
76
+ application.
74
77
 
75
78
  **CLI:**
76
79
 
@@ -104,6 +107,42 @@ const invalid: InvalidDocument[] = validate(documentsGlob, schema)
104
107
 
105
108
  ![Validate](https://raw.githubusercontent.com/kamilkisiela/graphql-inspector/master/assets/validate.jpg)
106
109
 
110
+ ### Audit documents
111
+
112
+ Audit your documents for useful metrics such as query depth, directive count and alias count.
113
+
114
+ **CLI:**
115
+
116
+ $ graphql-inspector audit DOCUMENTS
117
+
118
+ **API:**
119
+
120
+ Not available
121
+
122
+ ```
123
+ $ yarn graphql-inspector audit "packages/**/*.graphql|packages/**/*.ts(x)"
124
+
125
+ Maximum depth is 16
126
+ Maximum alias amount is 3
127
+ Maximum directive amount is 6
128
+ ```
129
+
130
+ ```
131
+ $ yarn graphql-inspector audit "packages/**/*.graphql|packages/**/*.ts(x)" --detail
132
+
133
+ ┌────────────────┬───────┬─────────┬────────────┐
134
+ │ Operation Name │ Depth │ Aliases │ Directives │
135
+ ├────────────────┼───────┼─────────┼────────────┤
136
+ │ getFoo │ 1 │ 2 │ 6 │
137
+ ├────────────────┼───────┼─────────┼────────────┤
138
+ │ getBar │ 16 │ 3 │ 0 │
139
+ └────────────────┴───────┴─────────┴────────────┘
140
+
141
+ Maximum depth is 16
142
+ Maximum alias amount is 3
143
+ Maximum directive amount is 6
144
+ ```
145
+
107
146
  ### Serve faked GraphQL API
108
147
 
109
148
  Serves a GraphQL server with faked data and GraphQL Playground
@@ -250,7 +289,8 @@ Example:
250
289
 
251
290
  graphql-inspector validate ./src/**/*.{js,jsx,tsx,graphql} https://localhost:3000/graphql
252
291
 
253
- Supports TypeScript, JavaScript and GraphQL Files (_Extensions: ts,tsx,js,jsx,graphql,gql,graphqls_).
292
+ Supports TypeScript, JavaScript and GraphQL Files (_Extensions:
293
+ ts,tsx,js,jsx,graphql,gql,graphqls_).
254
294
 
255
295
  ### Help
256
296
 
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.1-alpha-20230111095532-bd016dc8",
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.1-alpha-20230111095532-bd016dc8",
11
+ "@graphql-inspector/code-loader": "3.4.1-alpha-20230111095532-bd016dc8",
12
+ "@graphql-inspector/commands": "3.4.1-alpha-20230111095532-bd016dc8",
13
+ "@graphql-inspector/coverage-command": "3.4.1-alpha-20230111095532-bd016dc8",
14
+ "@graphql-inspector/diff-command": "3.4.1-alpha-20230111095532-bd016dc8",
15
+ "@graphql-inspector/docs-command": "3.4.1-alpha-20230111095532-bd016dc8",
16
+ "@graphql-inspector/git-loader": "3.4.1-alpha-20230111095532-bd016dc8",
17
+ "@graphql-inspector/github-loader": "3.4.1-alpha-20230111095532-bd016dc8",
18
+ "@graphql-inspector/graphql-loader": "3.4.1-alpha-20230111095532-bd016dc8",
19
+ "@graphql-inspector/introspect-command": "3.4.1-alpha-20230111095532-bd016dc8",
20
+ "@graphql-inspector/json-loader": "3.4.1-alpha-20230111095532-bd016dc8",
21
+ "@graphql-inspector/loaders": "3.4.1-alpha-20230111095532-bd016dc8",
22
+ "@graphql-inspector/serve-command": "3.4.1-alpha-20230111095532-bd016dc8",
23
+ "@graphql-inspector/similar-command": "3.4.1-alpha-20230111095532-bd016dc8",
24
+ "@graphql-inspector/url-loader": "3.4.1-alpha-20230111095532-bd016dc8",
25
+ "@graphql-inspector/validate-command": "3.4.1-alpha-20230111095532-bd016dc8",
25
26
  "tslib": "^2.0.0",
26
27
  "yargs": "17.2.1"
27
28
  },