@graphql-inspector/coverage-command 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.
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { GlobalArgs, CommandFactory } from '@graphql-inspector/commands';
1
+ import { CommandFactory, GlobalArgs } from '@graphql-inspector/commands';
2
2
  import { Source as DocumentSource } from '@graphql-tools/utils';
3
3
  import { GraphQLSchema } from 'graphql';
4
4
  export { CommandFactory };
package/index.js CHANGED
@@ -3,16 +3,16 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const tslib = require('tslib');
6
+ const fs = require('fs');
7
+ const path = require('path');
6
8
  const commands = require('@graphql-inspector/commands');
7
- const logger = require('@graphql-inspector/logger');
8
9
  const core = require('@graphql-inspector/core');
10
+ const logger = require('@graphql-inspector/logger');
9
11
  const graphql = require('graphql');
10
- const path = require('path');
11
- const fs = require('fs');
12
12
 
13
13
  function handler({ schema, documents, silent, writePath, }) {
14
14
  const shouldWrite = typeof writePath !== 'undefined';
15
- const coverage = core.coverage(schema, documents.map((doc) => new graphql.Source(graphql.print(doc.document), doc.location)));
15
+ const coverage = core.coverage(schema, documents.map(doc => new graphql.Source(graphql.print(doc.document), doc.location)));
16
16
  if (silent !== true) {
17
17
  renderCoverage(coverage);
18
18
  }
@@ -37,7 +37,7 @@ function handler({ schema, documents, silent, writePath, }) {
37
37
  }
38
38
  }
39
39
  }
40
- const index = commands.createCommand((api) => {
40
+ const index = commands.createCommand(api => {
41
41
  const { loaders } = api;
42
42
  return {
43
43
  command: 'coverage <documents> <schema>',
@@ -104,16 +104,10 @@ function renderCoverage(coverage) {
104
104
  if (typeCoverage.children.hasOwnProperty(childName)) {
105
105
  const childCoverage = typeCoverage.children[childName];
106
106
  if (childCoverage.hits) {
107
- logger.Logger.log([
108
- indent(childName, 2),
109
- logger.chalk.italic.grey(`x ${childCoverage.hits}`),
110
- ].join(' '));
107
+ logger.Logger.log([indent(childName, 2), logger.chalk.italic.grey(`x ${childCoverage.hits}`)].join(' '));
111
108
  }
112
109
  else {
113
- logger.Logger.log([
114
- logger.chalk.redBright(indent(childName, 2)),
115
- logger.chalk.italic.grey('x 0'),
116
- ].join(' '));
110
+ logger.Logger.log([logger.chalk.redBright(indent(childName, 2)), logger.chalk.italic.grey('x 0')].join(' '));
117
111
  }
118
112
  }
119
113
  }
package/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import { __awaiter } from 'tslib';
2
+ import { writeFileSync } from 'fs';
3
+ import { extname } from 'path';
2
4
  import { createCommand, parseGlobalArgs, ensureAbsolute } from '@graphql-inspector/commands';
3
- import { Logger, chalk } from '@graphql-inspector/logger';
4
5
  import { coverage, getTypePrefix } from '@graphql-inspector/core';
6
+ import { Logger, chalk } from '@graphql-inspector/logger';
5
7
  import { Source, print } from 'graphql';
6
- import { extname } from 'path';
7
- import { writeFileSync } from 'fs';
8
8
 
9
9
  function handler({ schema, documents, silent, writePath, }) {
10
10
  const shouldWrite = typeof writePath !== 'undefined';
11
- const coverage$1 = coverage(schema, documents.map((doc) => new Source(print(doc.document), doc.location)));
11
+ const coverage$1 = coverage(schema, documents.map(doc => new Source(print(doc.document), doc.location)));
12
12
  if (silent !== true) {
13
13
  renderCoverage(coverage$1);
14
14
  }
@@ -33,7 +33,7 @@ function handler({ schema, documents, silent, writePath, }) {
33
33
  }
34
34
  }
35
35
  }
36
- const index = createCommand((api) => {
36
+ const index = createCommand(api => {
37
37
  const { loaders } = api;
38
38
  return {
39
39
  command: 'coverage <documents> <schema>',
@@ -100,16 +100,10 @@ function renderCoverage(coverage) {
100
100
  if (typeCoverage.children.hasOwnProperty(childName)) {
101
101
  const childCoverage = typeCoverage.children[childName];
102
102
  if (childCoverage.hits) {
103
- Logger.log([
104
- indent(childName, 2),
105
- chalk.italic.grey(`x ${childCoverage.hits}`),
106
- ].join(' '));
103
+ Logger.log([indent(childName, 2), chalk.italic.grey(`x ${childCoverage.hits}`)].join(' '));
107
104
  }
108
105
  else {
109
- Logger.log([
110
- chalk.redBright(indent(childName, 2)),
111
- chalk.italic.grey('x 0'),
112
- ].join(' '));
106
+ Logger.log([chalk.redBright(indent(childName, 2)), chalk.italic.grey('x 0')].join(' '));
113
107
  }
114
108
  }
115
109
  }
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@graphql-inspector/coverage-command",
3
- "version": "3.3.0",
3
+ "version": "3.4.1-alpha-20230111095532-bd016dc8",
4
4
  "description": "Schema Coverage in GraphQL Inspector",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
7
  "graphql": "^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
8
8
  },
9
9
  "dependencies": {
10
- "@graphql-inspector/commands": "3.3.0",
11
- "@graphql-inspector/core": "3.3.0",
12
- "@graphql-inspector/logger": "3.3.0",
10
+ "@graphql-inspector/commands": "3.4.1-alpha-20230111095532-bd016dc8",
11
+ "@graphql-inspector/core": "3.4.1-alpha-20230111095532-bd016dc8",
12
+ "@graphql-inspector/logger": "3.4.1-alpha-20230111095532-bd016dc8",
13
13
  "tslib": "^2.0.0"
14
14
  },
15
15
  "repository": {