@toptal/davinci-graphql-codegen 4.0.5 → 4.0.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @toptal/davinci-graphql-codegen
2
2
 
3
+ ## 4.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2193](https://github.com/toptal/davinci/pull/2193) [`b2db6d84`](https://github.com/toptal/davinci/commit/b2db6d8453635fd4ebe6c6870c9f48a089240fbb) Thanks [@alexvcasillas](https://github.com/alexvcasillas)!
8
+ - replace conditional debug logs with `verboseLog`` utility
9
+
3
10
  ## 4.0.5
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-graphql-codegen",
3
- "version": "4.0.5",
3
+ "version": "4.0.6",
4
4
  "description": "Codegen",
5
5
  "author": "Toptal",
6
6
  "license": "SEE LICENSE IN LICENSE.MD",
@@ -3,8 +3,7 @@ import { readFileSync } from 'fs'
3
3
  import path from 'path'
4
4
  import chalk from 'chalk'
5
5
 
6
- import { verboseEnabled } from '../../../utils/verbose-enabled.js'
7
- import verboseLog from '../../../utils/verbose-log.js'
6
+ import logWhenVerboseEnabled from '../../../utils/log-when-verbose-enabled.js'
8
7
  import { requireResolve } from '../../../utils/require-resolve.js'
9
8
 
10
9
  const NEWLINE_PATTERN = /(\r\n|\r|\n)+/
@@ -31,7 +30,7 @@ const resolveImports = (filePath, resolvedPaths = new Set()) => {
31
30
  if (importPath.startsWith('@')) {
32
31
  const resolvedPath = requireResolve(importPath)
33
32
 
34
- verboseLog(
33
+ logWhenVerboseEnabled(
35
34
  `[${chalk.blue('Log')}] Resolved Fragment: ${chalk.green(
36
35
  resolvedPath.split('/').pop()
37
36
  )}`
@@ -48,7 +47,7 @@ const resolveImports = (filePath, resolvedPaths = new Set()) => {
48
47
  // Relative imports resolution
49
48
  const foundFilePath = path.resolve(path.dirname(filePath), importPath)
50
49
 
51
- verboseLog(
50
+ logWhenVerboseEnabled(
52
51
  `[${chalk.blue('Log')}] Resolved Fragment: ${chalk.green(
53
52
  foundFilePath.split('/').pop()
54
53
  )}`
@@ -80,11 +79,9 @@ export const plugin = docString => {
80
79
  })
81
80
  }
82
81
 
83
- if (verboseEnabled()) {
84
- console.log(
85
- `[${chalk.blue('Log')}] Resolved ${resolvedPaths.size} Fragment(s)`
86
- )
87
- }
82
+ logWhenVerboseEnabled(
83
+ `[${chalk.blue('Log')}] Resolved ${resolvedPaths.size} Fragment(s)`
84
+ )
88
85
 
89
86
  return [docString, ...resolvedPaths]
90
87
  }
@@ -12,6 +12,7 @@ import {
12
12
  import getSchemaPath from '../services/get-schema-path.js'
13
13
  import getRelativeFilePath from '../utils/get-relative-file-path.js'
14
14
  import { plugin as fragmentImportResolverGraphQL } from '../extensions/fragment-import-resolver/graphql/index.js'
15
+ import logWhenVerboseEnabled from '../utils/log-when-verbose-enabled.js'
15
16
 
16
17
  const { readFileSync, writeFileSync } = fsExtra
17
18
 
@@ -99,11 +100,9 @@ const generateOperations = async ({
99
100
  },
100
101
  }
101
102
 
102
- if (process.env.VERBOSE === 'true') {
103
- console.log(`ℹ️ GQL configuration:
104
- ${JSON.stringify(gqlConfiguration, null, 2)}
103
+ logWhenVerboseEnabled(`ℹ️ GQL configuration:
104
+ ${JSON.stringify(gqlConfiguration, null, 2)}
105
105
  `)
106
- }
107
106
 
108
107
  await generate(gqlConfiguration, true)
109
108
  }
@@ -11,6 +11,7 @@ import {
11
11
  autoGenerationComments,
12
12
  } from '../config/config.js'
13
13
  import schemaLoader from '../services/schema-loader.js'
14
+ import logWhenVerboseEnabled from '../utils/log-when-verbose-enabled.js'
14
15
 
15
16
  const localRequire = createRequire(import.meta.url)
16
17
 
@@ -77,11 +78,9 @@ const generateSchema = async ({
77
78
  },
78
79
  }
79
80
 
80
- if (process.env.VERBOSE === 'true') {
81
- console.log(`ℹ️ GQL configuration:
82
- ${JSON.stringify(gqlConfiguration, null, 2)}
81
+ logWhenVerboseEnabled(`ℹ️ GQL configuration:
82
+ ${JSON.stringify(gqlConfiguration, null, 2)}
83
83
  `)
84
- }
85
84
 
86
85
  await generate(gqlConfiguration, true)
87
86
  }