@graphcommerce/next-config 6.2.0-canary.88 → 6.2.0-canary.89

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,7 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.2.0-canary.89
4
+
3
5
  ## 6.2.0-canary.88
4
6
 
5
7
  ## 6.2.0-canary.87
@@ -1,32 +1,35 @@
1
1
  import { generateInterceptors } from '../../src/interceptors/generateInterceptors'
2
- import { writeInterceptors } from '../../src/interceptors/writeInterceptors'
3
2
  import { resolveDependency } from '../../src/utils/resolveDependency'
4
3
 
5
4
  const projectRoot = `${process.cwd()}/examples/magento-graphcms`
6
5
 
7
6
  it('writes all interceptors to disk', () => {
8
7
  const resolve = resolveDependency(projectRoot)
9
- const interceptors = generateInterceptors(
8
+ generateInterceptors(
10
9
  [
11
10
  {
12
11
  component: 'PaymentMethodContextProvider',
13
12
  exported: '@graphcommerce/magento-cart-payment-method',
14
13
  plugin: '@graphcommerce/mollie-magento-payment/plugins/AddMollieMethods',
14
+ enabled: true,
15
15
  },
16
16
  {
17
17
  component: 'PaymentMethodContextProvider',
18
18
  exported: '@graphcommerce/magento-cart-payment-method',
19
19
  plugin: '@graphcommerce/magento-payment-braintree/plugins/AddBraintreeMethods',
20
+ enabled: true,
20
21
  },
21
22
  {
22
23
  component: 'PaymentMethodContextProvider',
23
24
  exported: '@graphcommerce/magento-cart-payment-method',
24
25
  plugin: '@graphcommerce/magento-payment-included/plugins/AddIncludedMethods',
26
+ enabled: true,
25
27
  },
26
28
  {
27
29
  component: 'PaymentMethodContextProvider',
28
30
  exported: '@graphcommerce/magento-cart-payment-method',
29
31
  plugin: '@graphcommerce/magento-payment-paypal/plugins/AddPaypalMethods',
32
+ enabled: true,
30
33
  },
31
34
  ],
32
35
  resolve,
@@ -6,6 +6,7 @@ const exportConfigToEnv_1 = require("../utils/exportConfigToEnv");
6
6
  // eslint-disable-next-line @typescript-eslint/require-await
7
7
  async function exportConfig() {
8
8
  const conf = (0, loadConfig_1.loadConfig)(process.cwd());
9
+ // eslint-disable-next-line no-console
9
10
  console.log((0, exportConfigToEnv_1.exportConfigToEnv)(conf));
10
11
  }
11
12
  exports.exportConfig = exportConfig;
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.loadConfig = void 0;
18
+ /* eslint-disable no-console */
18
19
  // eslint-disable-next-line import/no-extraneous-dependencies
19
20
  const cosmiconfig_1 = require("cosmiconfig");
20
21
  const config_1 = require("../generated/config");
@@ -84,7 +84,7 @@ function rewriteLegacyEnv(schema, env, config = {}) {
84
84
  config.storefront = [];
85
85
  config.storefront.forEach((storefront, index) => {
86
86
  if (!inclTax.includes(storefront.locale))
87
- return null;
87
+ return;
88
88
  clonedEnv[`GC_STOREFRONT_${index}_CART_DISPLAY_PRICES_INCL_TAX`] = '1';
89
89
  });
90
90
  applied.push({
@@ -13,6 +13,7 @@ class InterceptorPlugin {
13
13
  constructor(config) {
14
14
  this.config = config;
15
15
  this.resolveDependency = (0, resolveDependency_1.resolveDependency)();
16
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
17
  const [plugins, errors] = (0, findPlugins_1.findPlugins)(this.config);
17
18
  this.interceptors = (0, generateInterceptors_1.generateInterceptors)(plugins, this.resolveDependency, this.config.debug);
18
19
  this.interceptorByDepependency = Object.fromEntries(Object.values(this.interceptors).map((i) => [i.dependency, i]));
@@ -22,6 +23,7 @@ class InterceptorPlugin {
22
23
  const logger = compiler.getInfrastructureLogger('InterceptorPlugin');
23
24
  // After the compilation has succeeded we watch all possible plugin locations.
24
25
  compiler.hooks.afterCompile.tap('InterceptorPlugin', (compilation) => {
26
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
25
27
  const [plugins, errors] = (0, findPlugins_1.findPlugins)(this.config);
26
28
  plugins.forEach((p) => {
27
29
  const absoluteFilePath = `${path_1.default.join(process.cwd(), this.resolveDependency(p.plugin).fromRoot)}.tsx`;
@@ -92,6 +92,7 @@ function findPlugins(config, cwd = process.cwd()) {
92
92
  pluginLogs[key] = logStr;
93
93
  }
94
94
  });
95
+ // eslint-disable-next-line no-console
95
96
  console.log(toLog.join('\n\n'));
96
97
  }
97
98
  return [plugins, errors];
@@ -26,6 +26,6 @@ const packageRoots = (packagePaths) => {
26
26
  }
27
27
  });
28
28
  // Filter out the sub-paths which are part of another longer sub-path
29
- return roots.filter((root, index, self) => self.findIndex((r) => r !== root && r.startsWith(root + '/')) === -1);
29
+ return roots.filter((root, index, self) => self.findIndex((r) => r !== root && r.startsWith(`${root}/`)) === -1);
30
30
  };
31
31
  exports.packageRoots = packageRoots;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/next-config",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "6.2.0-canary.88",
5
+ "version": "6.2.0-canary.89",
6
6
  "type": "commonjs",
7
7
  "main": "dist/index.js",
8
8
  "types": "src/index.ts",
@@ -4,5 +4,6 @@ import { exportConfigToEnv } from '../utils/exportConfigToEnv'
4
4
  // eslint-disable-next-line @typescript-eslint/require-await
5
5
  export async function exportConfig() {
6
6
  const conf = loadConfig(process.cwd())
7
+ // eslint-disable-next-line no-console
7
8
  console.log(exportConfigToEnv(conf))
8
9
  }
@@ -1,9 +1,10 @@
1
+ /* eslint-disable no-console */
1
2
  // eslint-disable-next-line import/no-extraneous-dependencies
2
3
  import { cosmiconfigSync } from 'cosmiconfig'
3
4
  import type { GraphCommerceConfig } from '../generated/config'
4
5
  import { GraphCommerceConfigSchema } from '../generated/config'
5
6
  import { demoConfig } from './demoConfig'
6
- import { filterEnv, formatAppliedEnv } from './utils/mergeEnvIntoConfig'
7
+ import { formatAppliedEnv } from './utils/mergeEnvIntoConfig'
7
8
  import { rewriteLegacyEnv } from './utils/rewriteLegacyEnv'
8
9
 
9
10
  export * from './utils/configToImportMeta'
@@ -15,6 +15,8 @@ import {
15
15
  ZodEffects,
16
16
  ZodRawShape,
17
17
  ZodEnum,
18
+ ZodTypeAny,
19
+ ZodAny,
18
20
  } from 'zod'
19
21
  import diff from './diff'
20
22
 
@@ -39,14 +41,15 @@ function isJSON(str: string | undefined): boolean {
39
41
  }
40
42
 
41
43
  export type ZodNode =
42
- | ZodNullable<any>
43
- | ZodOptional<any>
44
- | ZodEffects<any>
45
- | ZodObject<any>
46
- | ZodArray<any>
44
+ | ZodNullable<ZodTypeAny>
45
+ | ZodOptional<ZodTypeAny>
46
+ | ZodEffects<ZodTypeAny>
47
+ | ZodObject<ZodRawShape>
48
+ | ZodArray<ZodTypeAny>
47
49
  | ZodString
48
50
  | ZodNumber
49
51
  | ZodBoolean
52
+ | ZodAny
50
53
 
51
54
  export function configToEnvSchema(schema: ZodNode) {
52
55
  const envSchema: ZodRawShape = {}
@@ -91,7 +91,7 @@ export function rewriteLegacyEnv(
91
91
 
92
92
  if (!config.storefront) config.storefront = []
93
93
  config.storefront.forEach((storefront, index) => {
94
- if (!inclTax.includes(storefront.locale)) return null
94
+ if (!inclTax.includes(storefront.locale)) return
95
95
  clonedEnv[`GC_STOREFRONT_${index}_CART_DISPLAY_PRICES_INCL_TAX`] = '1'
96
96
  })
97
97
 
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1
2
  import type React from 'react'
2
3
 
3
4
  export * from './utils/isMonorepo'
@@ -16,6 +16,7 @@ export class InterceptorPlugin {
16
16
  constructor(private config: GraphCommerceConfig) {
17
17
  this.resolveDependency = resolveDependency()
18
18
 
19
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
19
20
  const [plugins, errors] = findPlugins(this.config)
20
21
  this.interceptors = generateInterceptors(plugins, this.resolveDependency, this.config.debug)
21
22
  this.interceptorByDepependency = Object.fromEntries(
@@ -30,6 +31,7 @@ export class InterceptorPlugin {
30
31
 
31
32
  // After the compilation has succeeded we watch all possible plugin locations.
32
33
  compiler.hooks.afterCompile.tap('InterceptorPlugin', (compilation) => {
34
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
35
  const [plugins, errors] = findPlugins(this.config)
34
36
 
35
37
  plugins.forEach((p) => {
@@ -122,6 +122,7 @@ export function findPlugins(config: GraphCommerceConfig, cwd: string = process.c
122
122
  }
123
123
  })
124
124
 
125
+ // eslint-disable-next-line no-console
125
126
  console.log(toLog.join('\n\n'))
126
127
  }
127
128
 
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path'
2
- import { GraphCommerceConfig, GraphCommerceDebugConfig } from '../generated/config'
2
+ import { GraphCommerceDebugConfig } from '../generated/config'
3
3
  import { ResolveDependency, ResolveDependencyReturn } from '../utils/resolveDependency'
4
4
 
5
5
  type PluginBaseConfig = {
@@ -30,6 +30,6 @@ export const packageRoots = (packagePaths: string[]): string[] => {
30
30
 
31
31
  // Filter out the sub-paths which are part of another longer sub-path
32
32
  return roots.filter(
33
- (root, index, self) => self.findIndex((r) => r !== root && r.startsWith(root + '/')) === -1,
33
+ (root, index, self) => self.findIndex((r) => r !== root && r.startsWith(`${root }/`)) === -1,
34
34
  )
35
35
  }