@graphql-markdown/core 1.0.0 → 1.0.1

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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "bugs": {
6
6
  "url": "https://github.com/graphql-markdown/graphql-markdown/issues"
7
7
  },
8
- "version": "1.0.0",
8
+ "version": "1.0.1",
9
9
  "license": "MIT",
10
10
  "main": "src/index.js",
11
11
  "repository": {
@@ -29,7 +29,7 @@
29
29
  "stryker": "stryker run"
30
30
  },
31
31
  "dependencies": {
32
- "@graphql-markdown/utils": "^1.0.0"
32
+ "@graphql-markdown/utils": "^1.0.1"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@graphql-markdown/printer-legacy": "^1.0.0",
package/src/config.js CHANGED
@@ -32,11 +32,11 @@ const DEFAULT_OPTIONS = {
32
32
  function buildConfig(configFileOpts, cliOpts) {
33
33
  let config = DEFAULT_OPTIONS;
34
34
 
35
- if (typeof configFileOpts != "undefined" && configFileOpts != null) {
35
+ if (typeof configFileOpts !== "undefined" && configFileOpts != null) {
36
36
  config = { ...DEFAULT_OPTIONS, ...configFileOpts };
37
37
  }
38
38
 
39
- if (typeof cliOpts == "undefined" || cliOpts == null) {
39
+ if (typeof cliOpts === "undefined" || cliOpts == null) {
40
40
  cliOpts = {};
41
41
  }
42
42
 
@@ -11,14 +11,14 @@ const hasChanges = async (
11
11
  diffMethod,
12
12
  diffModule = "@graphql-markdown/diff",
13
13
  ) => {
14
- if (typeof diffMethod == "undefined" || diffMethod == null) {
14
+ if (typeof diffMethod === "undefined" || diffMethod == null) {
15
15
  return true;
16
16
  }
17
17
 
18
18
  try {
19
19
  const { checkSchemaChanges } = require(diffModule);
20
20
  return await checkSchemaChanges(schema, tmpDir, diffMethod);
21
- } catch (e) {
21
+ } catch (error) {
22
22
  console.warn(
23
23
  `Cannot find module '${diffModule}' from @graphql-markdown/core!`,
24
24
  );
@@ -35,7 +35,7 @@ const getPrinter = (
35
35
  printTypeOptions,
36
36
  printerModule,
37
37
  ) => {
38
- if (typeof printerModule != "string") {
38
+ if (typeof printerModule !== "string") {
39
39
  throw new Error(
40
40
  "Invalid printer module name in printTypeOptions settings.",
41
41
  );
@@ -47,7 +47,7 @@ const getPrinter = (
47
47
  groups,
48
48
  printTypeOptions,
49
49
  });
50
- } catch (e) {
50
+ } catch (error) {
51
51
  throw new Error(
52
52
  `Cannot find module '${printerModule}' from @graphql-markdown/core in printTypeOptions settings.`,
53
53
  );
@@ -62,14 +62,15 @@ const generateDocFromSchema = async ({
62
62
  homepageLocation,
63
63
  diffMethod,
64
64
  tmpDir,
65
- loaders,
65
+ loaders: loadersList,
66
66
  groupByDirective,
67
67
  prettify,
68
68
  docOptions,
69
69
  printTypeOptions,
70
70
  printer: printerModule,
71
71
  }) => {
72
- const schema = await loadSchema(schemaLocation, getDocumentLoaders(loaders));
72
+ const loaders = getDocumentLoaders(loadersList);
73
+ const schema = await loadSchema(schemaLocation, loaders);
73
74
 
74
75
  const changed = await hasChanges(schema, tmpDir, diffMethod);
75
76
  if (!changed) {
@@ -13,7 +13,7 @@ function parseGroupByOption(groupOptions) {
13
13
 
14
14
  const parsedOptions = OPTION_REGEX.exec(groupOptions);
15
15
 
16
- if (typeof parsedOptions == "undefined" || parsedOptions == null) {
16
+ if (typeof parsedOptions === "undefined" || parsedOptions == null) {
17
17
  throw new Error(`Invalid "${groupOptions}"`);
18
18
  }
19
19
 
@@ -24,7 +24,7 @@ function parseGroupByOption(groupOptions) {
24
24
  function getGroups(rootTypes, groupByDirective) {
25
25
  let groups = {};
26
26
 
27
- if (typeof groupByDirective == "undefined" || groupByDirective == null) {
27
+ if (typeof groupByDirective === "undefined" || groupByDirective == null) {
28
28
  return undefined;
29
29
  }
30
30
 
@@ -47,7 +47,7 @@ function getGroups(rootTypes, groupByDirective) {
47
47
  function getGroupName(type, groupByDirective) {
48
48
  let group = groupByDirective.fallback; // default value is fallback, and it will be only overridden if a group is found
49
49
 
50
- if (typeof type.astNode == "undefined" || type.astNode == null) {
50
+ if (typeof type.astNode === "undefined" || type.astNode == null) {
51
51
  return group;
52
52
  }
53
53