@graphcommerce/next-config 6.0.2-canary.0 → 6.0.2-canary.10
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 +32 -0
- package/__tests__/config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap +1 -0
- package/__tests__/interceptors/findPlugins.ts +20 -0
- package/__tests__/interceptors/generateInterceptors.ts +17 -0
- package/dist/generated/config.js +2 -1
- package/dist/interceptors/generateInterceptors.js +1 -1
- package/dist/utils/resolveDependency.js +1 -1
- package/dist/withGraphCommerce.js +4 -0
- package/package.json +1 -1
- package/src/generated/config.ts +4 -1
- package/src/interceptors/generateInterceptors.ts +4 -1
- package/src/utils/resolveDependency.ts +1 -1
- package/src/withGraphCommerce.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 6.0.2-canary.10
|
|
4
|
+
|
|
5
|
+
## 6.0.2-canary.9
|
|
6
|
+
|
|
7
|
+
## 6.0.2-canary.8
|
|
8
|
+
|
|
9
|
+
## 6.0.2-canary.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1876](https://github.com/graphcommerce-org/graphcommerce/pull/1876) [`8dffc59c0`](https://github.com/graphcommerce-org/graphcommerce/commit/8dffc59c04bf6f2a6000b73db13592e10afd936c) - Added an configuration to the wishlist: `wishlistShowFeedbackMessage` to show a feedback message when a product is added to the wishlist. ([@paales](https://github.com/paales))
|
|
14
|
+
|
|
15
|
+
## 6.0.2-canary.6
|
|
16
|
+
|
|
17
|
+
## 6.0.2-canary.5
|
|
18
|
+
|
|
19
|
+
## 6.0.2-canary.4
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#1874](https://github.com/graphcommerce-org/graphcommerce/pull/1874) [`2a60491c2`](https://github.com/graphcommerce-org/graphcommerce/commit/2a60491c23a9cd0bfd79296d29f6c9ee31faada5) - Magento couldn't respond with any cached Varnish responses because there was an empty authorization header sent with each request. ([@paales](https://github.com/paales))
|
|
24
|
+
|
|
25
|
+
## 6.0.2-canary.3
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [#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))
|
|
30
|
+
|
|
31
|
+
## 6.0.2-canary.2
|
|
32
|
+
|
|
33
|
+
## 6.0.2-canary.1
|
|
34
|
+
|
|
3
35
|
## 6.0.2-canary.0
|
|
4
36
|
|
|
5
37
|
## 6.0.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
|
+
})
|
package/dist/generated/config.js
CHANGED
|
@@ -26,7 +26,8 @@ function GraphCommerceConfigSchema() {
|
|
|
26
26
|
robotsAllow: zod_1.z.boolean().nullish(),
|
|
27
27
|
storefront: zod_1.z.array(GraphCommerceStorefrontConfigSchema()),
|
|
28
28
|
wishlistHideForGuests: zod_1.z.boolean().nullish(),
|
|
29
|
-
wishlistIgnoreProductWishlistStatus: zod_1.z.boolean().nullish()
|
|
29
|
+
wishlistIgnoreProductWishlistStatus: zod_1.z.boolean().nullish(),
|
|
30
|
+
wishlistShowFeedbackMessage: zod_1.z.boolean().nullish()
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
exports.GraphCommerceConfigSchema = GraphCommerceConfigSchema;
|
|
@@ -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.
|
|
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
|
|
29
|
+
throw Error(`Can't find plugin ${dependency}`);
|
|
30
30
|
}
|
|
31
31
|
const denormalized = fromRoot.replace(root, depCandidate);
|
|
32
32
|
let fromModule = !relative
|
|
@@ -52,6 +52,10 @@ function withGraphCommerce(nextConfig, cwd) {
|
|
|
52
52
|
];
|
|
53
53
|
return {
|
|
54
54
|
...nextConfig,
|
|
55
|
+
experimental: {
|
|
56
|
+
enableUndici: true,
|
|
57
|
+
...nextConfig.experimental,
|
|
58
|
+
},
|
|
55
59
|
i18n: {
|
|
56
60
|
defaultLocale: storefront.find((locale) => locale.defaultLocale)?.locale ?? storefront[0].locale,
|
|
57
61
|
locales: storefront.map((locale) => locale.locale),
|
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.
|
|
5
|
+
"version": "6.0.2-canary.10",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "src/index.ts",
|
package/src/generated/config.ts
CHANGED
|
@@ -194,6 +194,8 @@ export type GraphCommerceConfig = {
|
|
|
194
194
|
wishlistHideForGuests?: InputMaybe<Scalars['Boolean']>;
|
|
195
195
|
/** Ignores wether a product is already in the wishlist, makes the toggle an add only. */
|
|
196
196
|
wishlistIgnoreProductWishlistStatus?: InputMaybe<Scalars['Boolean']>;
|
|
197
|
+
/** Show a message when the product is added to the wishlist. */
|
|
198
|
+
wishlistShowFeedbackMessage?: InputMaybe<Scalars['Boolean']>;
|
|
197
199
|
};
|
|
198
200
|
|
|
199
201
|
/** Debug configuration for GraphCommerce */
|
|
@@ -298,7 +300,8 @@ export function GraphCommerceConfigSchema(): z.ZodObject<Properties<GraphCommerc
|
|
|
298
300
|
robotsAllow: z.boolean().nullish(),
|
|
299
301
|
storefront: z.array(GraphCommerceStorefrontConfigSchema()),
|
|
300
302
|
wishlistHideForGuests: z.boolean().nullish(),
|
|
301
|
-
wishlistIgnoreProductWishlistStatus: z.boolean().nullish()
|
|
303
|
+
wishlistIgnoreProductWishlistStatus: z.boolean().nullish(),
|
|
304
|
+
wishlistShowFeedbackMessage: z.boolean().nullish()
|
|
302
305
|
})
|
|
303
306
|
}
|
|
304
307
|
|
|
@@ -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(
|
|
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
|
|
38
|
+
throw Error(`Can't find plugin ${dependency}`)
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const denormalized = fromRoot.replace(root, depCandidate)
|
package/src/withGraphCommerce.ts
CHANGED
|
@@ -61,6 +61,10 @@ export function withGraphCommerce(nextConfig: NextConfig, cwd: string): NextConf
|
|
|
61
61
|
|
|
62
62
|
return {
|
|
63
63
|
...nextConfig,
|
|
64
|
+
experimental: {
|
|
65
|
+
enableUndici: true,
|
|
66
|
+
...nextConfig.experimental,
|
|
67
|
+
},
|
|
64
68
|
i18n: {
|
|
65
69
|
defaultLocale:
|
|
66
70
|
storefront.find((locale) => locale.defaultLocale)?.locale ?? storefront[0].locale,
|