@graphcommerce/next-config 6.0.2-canary.2 → 6.0.2-canary.3

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
  # Change Log
2
2
 
3
+ ## 6.0.2-canary.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1872](https://github.com/graphcommerce-org/graphcommerce/pull/1872) [`05522796f`](https://github.com/graphcommerce-org/graphcommerce/commit/05522796f3f132db50e7b4c26089740a12a9153a) - Fix issue where a deeper plugin from the root of the project doesn't have a correct relative path ([@paales](https://github.com/paales))
8
+
3
9
  ## 6.0.2-canary.2
4
10
 
5
11
  ## 6.0.2-canary.1
@@ -741,5 +741,6 @@ exports[`traverses a schema and returns a list of env variables that match 1`] =
741
741
  "GC_STOREFRONT_20_MAGENTO_STORE_CODE",
742
742
  "GC_WISHLIST_HIDE_FOR_GUESTS",
743
743
  "GC_WISHLIST_IGNORE_PRODUCT_WISHLIST_STATUS",
744
+ "GC_WISHLIST_SHOW_FEEDBACK_MESSAGE",
744
745
  ]
745
746
  `;
@@ -71,6 +71,13 @@ it('finds plugins', () => {
71
71
  "ifConfig": "googleAnalyticsId",
72
72
  "plugin": "@graphcommerce/googleanalytics/plugins/GaProductListItemsBase",
73
73
  },
74
+ {
75
+ "component": "RemoveItemFromCartFab",
76
+ "enabled": true,
77
+ "exported": "@graphcommerce/magento-cart-items/RemoveItemFromCart/RemoveItemFromCartFab",
78
+ "ifConfig": "googleAnalyticsId",
79
+ "plugin": "@graphcommerce/googleanalytics/plugins/GaRemoveItemFromCart",
80
+ },
74
81
  {
75
82
  "component": "ShippingMethodForm",
76
83
  "enabled": true,
@@ -85,6 +92,12 @@ it('finds plugins', () => {
85
92
  "ifConfig": "googleAnalyticsId",
86
93
  "plugin": "@graphcommerce/googleanalytics/plugins/GaUpdateItemQuantity",
87
94
  },
95
+ {
96
+ "component": "ProductPageMeta",
97
+ "enabled": true,
98
+ "exported": "@graphcommerce/magento-product",
99
+ "plugin": "@graphcommerce/googleanalytics/plugins/GaViewItem",
100
+ },
88
101
  {
89
102
  "component": "ApolloErrorAlert",
90
103
  "enabled": true,
@@ -187,6 +200,13 @@ it('finds plugins', () => {
187
200
  "ifConfig": "demoMode",
188
201
  "plugin": "@graphcommerce/demo-magento-graphcommerce/plugins/demo/DemoProductListItemsBase",
189
202
  },
203
+ {
204
+ "component": "RowLinks",
205
+ "enabled": false,
206
+ "exported": "@graphcommerce/next-ui/Row/RowLinks/RowLinks",
207
+ "ifConfig": "demoMode",
208
+ "plugin": "@graphcommerce/demo-magento-graphcommerce/plugins/demo/DemoRowLinks",
209
+ },
190
210
  {
191
211
  "component": "FramerNextPages",
192
212
  "enabled": false,
@@ -250,3 +250,20 @@ it('it handles root plugins', () => {
250
250
  "
251
251
  `)
252
252
  })
253
+
254
+ it('it handles root plugins deeper nested', () => {
255
+ const plugins = [
256
+ {
257
+ component: 'OverlaySsr',
258
+ enabled: true,
259
+ exported: '@graphcommerce/next-ui/Overlay/components/OverlaySsr',
260
+ plugin: './plugins/EnableCrosssellsPlugin',
261
+ },
262
+ ]
263
+ const resolve = resolveDependency(projectRoot)
264
+ const interceptors = generateInterceptors(plugins, resolve)
265
+
266
+ expect(
267
+ interceptors['packages/next-ui/Overlay/components/OverlaySsr'].components.OverlaySsr[0].plugin,
268
+ ).toMatchInlineSnapshot(`"../../../../examples/magento-graphcms/plugins/EnableCrosssellsPlugin"`)
269
+ })
@@ -92,7 +92,7 @@ function generateInterceptors(plugins, resolve) {
92
92
  let pluginPathFromResolved = plugin;
93
93
  if (plugin.startsWith('.')) {
94
94
  const resolvedPlugin = resolve(plugin);
95
- pluginPathFromResolved = node_path_1.default.relative(resolved.root, resolvedPlugin.fromRoot);
95
+ pluginPathFromResolved = node_path_1.default.relative(resolved.fromRoot.split('/').slice(0, -1).join('/'), resolvedPlugin.fromRoot);
96
96
  }
97
97
  if (!acc[resolved.fromRoot])
98
98
  acc[resolved.fromRoot] = {
@@ -26,7 +26,7 @@ const resolveDependency = (cwd = process.cwd()) => {
26
26
  `${rootCandidate}/src/index`,
27
27
  ].find((location) => ['ts', 'tsx'].find((extension) => node_fs_1.default.existsSync(`${location}.${extension}`)));
28
28
  if (!fromRoot) {
29
- throw Error(`Can't find plugin target for ${dependency}`);
29
+ throw Error(`Can't find plugin ${dependency}`);
30
30
  }
31
31
  const denormalized = fromRoot.replace(root, depCandidate);
32
32
  let fromModule = !relative
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.0.2-canary.2",
5
+ "version": "6.0.2-canary.3",
6
6
  "type": "commonjs",
7
7
  "main": "dist/index.js",
8
8
  "types": "src/index.ts",
@@ -122,7 +122,10 @@ export function generateInterceptors(
122
122
  let pluginPathFromResolved = plugin
123
123
  if (plugin.startsWith('.')) {
124
124
  const resolvedPlugin = resolve(plugin)
125
- pluginPathFromResolved = path.relative(resolved.root, resolvedPlugin.fromRoot)
125
+ pluginPathFromResolved = path.relative(
126
+ resolved.fromRoot.split('/').slice(0, -1).join('/'),
127
+ resolvedPlugin.fromRoot,
128
+ )
126
129
  }
127
130
 
128
131
  if (!acc[resolved.fromRoot])
@@ -35,7 +35,7 @@ export const resolveDependency = (cwd: string = process.cwd()) => {
35
35
  ['ts', 'tsx'].find((extension) => fs.existsSync(`${location}.${extension}`)),
36
36
  )
37
37
  if (!fromRoot) {
38
- throw Error(`Can't find plugin target for ${dependency}`)
38
+ throw Error(`Can't find plugin ${dependency}`)
39
39
  }
40
40
 
41
41
  const denormalized = fromRoot.replace(root, depCandidate)