@graphcommerce/cli 1.0.5 → 1.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,11 @@
1
1
  # @graphcommerce/cli
2
2
 
3
+ ## 1.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1552](https://github.com/graphcommerce-org/graphcommerce/pull/1552) [`18054c441`](https://github.com/graphcommerce-org/graphcommerce/commit/18054c441962ba750bed3acc39ab46c8d3a341ce) Thanks [@paales](https://github.com/paales)! - Updated to Next.js v12.2.2 and other packages and made compatible
8
+
3
9
  ## 1.0.5
4
10
 
5
11
  ### Patch Changes
@@ -8,7 +8,8 @@ exports.findConfig = void 0;
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const utils_1 = require("@graphql-mesh/utils");
10
10
  const cosmiconfig_1 = require("cosmiconfig");
11
- function customLoader(ext, importFn = utils_1.defaultImportFn) {
11
+ function customLoader(ext, importFn = utils_1.defaultImportFn, initialLoggerPrefix = '🕸️ Mesh') {
12
+ const logger = new utils_1.DefaultLogger(initialLoggerPrefix).child('config');
12
13
  // eslint-disable-next-line consistent-return
13
14
  function loader(filepath, content) {
14
15
  if (process.env) {
@@ -28,7 +29,7 @@ function customLoader(ext, importFn = utils_1.defaultImportFn) {
28
29
  return cosmiconfig_1.defaultLoaders['.json'](filepath, content);
29
30
  }
30
31
  if (ext === 'yaml') {
31
- return (0, utils_1.loadYaml)(filepath, content);
32
+ return (0, utils_1.loadYaml)(filepath, content, logger);
32
33
  }
33
34
  if (ext === 'js') {
34
35
  return importFn(filepath);
@@ -37,7 +38,7 @@ function customLoader(ext, importFn = utils_1.defaultImportFn) {
37
38
  return loader;
38
39
  }
39
40
  async function findConfig(options) {
40
- const { configName = 'mesh', dir: configDir = '' } = options || {};
41
+ const { configName = 'mesh', dir: configDir = '', initialLoggerPrefix } = options || {};
41
42
  const dir = path_1.default.isAbsolute(configDir) ? configDir : path_1.default.join(process.cwd(), configDir);
42
43
  const explorer = (0, cosmiconfig_1.cosmiconfig)(configName, {
43
44
  searchPlaces: [
@@ -53,12 +54,12 @@ async function findConfig(options) {
53
54
  `${configName}.config.cjs`,
54
55
  ],
55
56
  loaders: {
56
- '.json': customLoader('json', options?.importFn),
57
- '.yaml': customLoader('yaml', options?.importFn),
58
- '.yml': customLoader('yaml', options?.importFn),
59
- '.js': customLoader('js', options?.importFn),
60
- '.ts': customLoader('js', options?.importFn),
61
- noExt: customLoader('yaml', options?.importFn),
57
+ '.json': customLoader('json', options?.importFn, initialLoggerPrefix),
58
+ '.yaml': customLoader('yaml', options?.importFn, initialLoggerPrefix),
59
+ '.yml': customLoader('yaml', options?.importFn, initialLoggerPrefix),
60
+ '.js': customLoader('js', options?.importFn, initialLoggerPrefix),
61
+ '.ts': customLoader('js', options?.importFn, initialLoggerPrefix),
62
+ noExt: customLoader('yaml', options?.importFn, initialLoggerPrefix),
62
63
  },
63
64
  });
64
65
  const results = await explorer.search(dir);
@@ -1,10 +1,16 @@
1
1
  /* eslint-disable import/no-extraneous-dependencies */
2
2
  import path from 'path'
3
3
  import { ConfigProcessOptions } from '@graphql-mesh/config'
4
- import { defaultImportFn, loadYaml } from '@graphql-mesh/utils'
4
+ import { defaultImportFn, loadYaml, DefaultLogger } from '@graphql-mesh/utils'
5
5
  import { cosmiconfig, defaultLoaders } from 'cosmiconfig'
6
6
 
7
- function customLoader(ext: 'json' | 'yaml' | 'js', importFn = defaultImportFn) {
7
+ function customLoader(
8
+ ext: 'json' | 'yaml' | 'js',
9
+ importFn = defaultImportFn,
10
+ initialLoggerPrefix = '🕸️ Mesh',
11
+ ) {
12
+ const logger = new DefaultLogger(initialLoggerPrefix).child('config')
13
+
8
14
  // eslint-disable-next-line consistent-return
9
15
  function loader(filepath: string, content: string) {
10
16
  if (process.env) {
@@ -28,7 +34,7 @@ function customLoader(ext: 'json' | 'yaml' | 'js', importFn = defaultImportFn) {
28
34
  }
29
35
 
30
36
  if (ext === 'yaml') {
31
- return loadYaml(filepath, content)
37
+ return loadYaml(filepath, content, logger)
32
38
  }
33
39
 
34
40
  if (ext === 'js') {
@@ -40,9 +46,9 @@ function customLoader(ext: 'json' | 'yaml' | 'js', importFn = defaultImportFn) {
40
46
  }
41
47
 
42
48
  export async function findConfig(
43
- options?: Pick<ConfigProcessOptions, 'configName' | 'dir' | 'importFn'>,
49
+ options?: Pick<ConfigProcessOptions, 'configName' | 'dir' | 'importFn' | 'initialLoggerPrefix'>,
44
50
  ) {
45
- const { configName = 'mesh', dir: configDir = '' } = options || {}
51
+ const { configName = 'mesh', dir: configDir = '', initialLoggerPrefix } = options || {}
46
52
  const dir = path.isAbsolute(configDir) ? configDir : path.join(process.cwd(), configDir)
47
53
  const explorer = cosmiconfig(configName, {
48
54
  searchPlaces: [
@@ -58,12 +64,12 @@ export async function findConfig(
58
64
  `${configName}.config.cjs`,
59
65
  ],
60
66
  loaders: {
61
- '.json': customLoader('json', options?.importFn),
62
- '.yaml': customLoader('yaml', options?.importFn),
63
- '.yml': customLoader('yaml', options?.importFn),
64
- '.js': customLoader('js', options?.importFn),
65
- '.ts': customLoader('js', options?.importFn),
66
- noExt: customLoader('yaml', options?.importFn),
67
+ '.json': customLoader('json', options?.importFn, initialLoggerPrefix),
68
+ '.yaml': customLoader('yaml', options?.importFn, initialLoggerPrefix),
69
+ '.yml': customLoader('yaml', options?.importFn, initialLoggerPrefix),
70
+ '.js': customLoader('js', options?.importFn, initialLoggerPrefix),
71
+ '.ts': customLoader('js', options?.importFn, initialLoggerPrefix),
72
+ noExt: customLoader('yaml', options?.importFn, initialLoggerPrefix),
67
73
  },
68
74
  })
69
75
  const results = await explorer.search(dir)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/cli",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "1.0.5",
5
+ "version": "1.0.6",
6
6
  "author": "",
7
7
  "license": "MIT",
8
8
  "scripts": {
@@ -19,17 +19,17 @@
19
19
  "graphql-code-generator": "dist/bin/codegen.js"
20
20
  },
21
21
  "dependencies": {
22
- "@graphql-codegen/cli": "2.6.2",
23
- "@graphql-mesh/cli": "0.73.1",
24
- "@graphql-mesh/types": "0.74.2",
25
- "@graphql-mesh/utils": "0.35.6"
22
+ "@graphql-codegen/cli": "2.8.0",
23
+ "@graphql-mesh/cli": "0.74.1",
24
+ "@graphql-mesh/types": "0.78.0",
25
+ "@graphql-mesh/utils": "0.37.1"
26
26
  },
27
27
  "devDependencies": {
28
- "@graphcommerce/eslint-config-pwa": "^4.1.8",
28
+ "@graphcommerce/eslint-config-pwa": "^4.1.9",
29
29
  "@graphcommerce/prettier-config-pwa": "^4.0.6",
30
- "@graphcommerce/typescript-config-pwa": "^4.0.2",
30
+ "@graphcommerce/typescript-config-pwa": "^4.0.4",
31
31
  "@playwright/test": "^1.21.1",
32
- "typescript": "4.7.3"
32
+ "typescript": "4.7.4"
33
33
  },
34
34
  "sideEffects": false,
35
35
  "prettier": "@graphcommerce/prettier-config-pwa",