@graphcommerce/next-config 9.0.0-canary.109 → 9.0.0-canary.110
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 +2 -0
- package/__tests__/config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap +2 -0
- package/dist/config/commands/generateConfig.js +2 -2
- package/dist/generated/config.js +4 -1
- package/dist/utils/isMonorepo.js +0 -28
- package/package.json +1 -1
- package/src/config/commands/generateConfig.ts +3 -3
- package/src/generated/config.ts +13 -0
- package/src/utils/isMonorepo.ts +0 -34
package/CHANGELOG.md
CHANGED
|
@@ -35,6 +35,8 @@ exports[`traverses a schema and returns a list of env variables that match 1`] =
|
|
|
35
35
|
"GC_CONFIGURABLE_VARIANT_VALUES_CONTENT",
|
|
36
36
|
"GC_CONFIGURABLE_VARIANT_VALUES_GALLERY",
|
|
37
37
|
"GC_CONFIGURABLE_VARIANT_VALUES_URL",
|
|
38
|
+
"GC_CONTAINER_SIZING_CONTENT",
|
|
39
|
+
"GC_CONTAINER_SIZING_SHELL",
|
|
38
40
|
"GC_CROSS_SELLS_HIDE_CART_ITEMS",
|
|
39
41
|
"GC_CROSS_SELLS_REDIRECT_ITEMS",
|
|
40
42
|
"GC_CUSTOMER_ADDRESS_NOTE_ENABLE",
|
|
@@ -5,10 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generateConfig = generateConfig;
|
|
7
7
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
8
|
+
const fs_1 = require("fs");
|
|
8
9
|
const cli_1 = require("@graphql-codegen/cli");
|
|
9
10
|
const core_1 = require("@swc/core");
|
|
10
11
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
11
|
-
const fs_1 = require("fs");
|
|
12
12
|
const isMonorepo_1 = require("../../utils/isMonorepo");
|
|
13
13
|
const resolveDependenciesSync_1 = require("../../utils/resolveDependenciesSync");
|
|
14
14
|
const resolveDependency_1 = require("../../utils/resolveDependency");
|
|
@@ -42,7 +42,7 @@ async function generateConfig() {
|
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
|
-
...((0, isMonorepo_1.
|
|
45
|
+
...((0, isMonorepo_1.findParentPath)(process.cwd()) && {
|
|
46
46
|
'../../docs/framework/config.md': {
|
|
47
47
|
plugins: ['@graphcommerce/graphql-codegen-markdown-docs'],
|
|
48
48
|
},
|
package/dist/generated/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebsitePermissionsSchema = exports.SidebarGalleryPaginationVariantSchema = exports.ProductFiltersLayoutSchema = exports.PaginationVariantSchema = exports.CustomerAccountPermissionsSchema = exports.CompareVariantSchema = exports.CartPermissionsSchema = exports.definedNonNullAnySchema = exports.isDefinedNonNullAny = void 0;
|
|
3
|
+
exports.WebsitePermissionsSchema = exports.SidebarGalleryPaginationVariantSchema = exports.ProductFiltersLayoutSchema = exports.PaginationVariantSchema = exports.CustomerAccountPermissionsSchema = exports.ContainerSizingSchema = exports.CompareVariantSchema = exports.CartPermissionsSchema = exports.definedNonNullAnySchema = exports.isDefinedNonNullAny = void 0;
|
|
4
4
|
exports.DatalayerConfigSchema = DatalayerConfigSchema;
|
|
5
5
|
exports.GraphCommerceConfigSchema = GraphCommerceConfigSchema;
|
|
6
6
|
exports.GraphCommerceDebugConfigSchema = GraphCommerceDebugConfigSchema;
|
|
@@ -17,6 +17,7 @@ exports.isDefinedNonNullAny = isDefinedNonNullAny;
|
|
|
17
17
|
exports.definedNonNullAnySchema = zod_1.z.any().refine((v) => (0, exports.isDefinedNonNullAny)(v));
|
|
18
18
|
exports.CartPermissionsSchema = zod_1.z.enum(['CUSTOMER_ONLY', 'DISABLED', 'ENABLED']);
|
|
19
19
|
exports.CompareVariantSchema = zod_1.z.enum(['CHECKBOX', 'ICON']);
|
|
20
|
+
exports.ContainerSizingSchema = zod_1.z.enum(['BREAKPOINT', 'FULL_WIDTH']);
|
|
20
21
|
exports.CustomerAccountPermissionsSchema = zod_1.z.enum(['DISABLED', 'DISABLE_REGISTRATION', 'ENABLED']);
|
|
21
22
|
exports.PaginationVariantSchema = zod_1.z.enum(['COMPACT', 'EXTENDED']);
|
|
22
23
|
exports.ProductFiltersLayoutSchema = zod_1.z.enum(['DEFAULT', 'SIDEBAR']);
|
|
@@ -36,6 +37,8 @@ function GraphCommerceConfigSchema() {
|
|
|
36
37
|
compareVariant: exports.CompareVariantSchema.default("ICON").nullish(),
|
|
37
38
|
configurableVariantForSimple: zod_1.z.boolean().default(false).nullish(),
|
|
38
39
|
configurableVariantValues: MagentoConfigurableVariantValuesSchema().nullish(),
|
|
40
|
+
containerSizingContent: exports.ContainerSizingSchema.default("FULL_WIDTH").nullish(),
|
|
41
|
+
containerSizingShell: exports.ContainerSizingSchema.default("FULL_WIDTH").nullish(),
|
|
39
42
|
crossSellsHideCartItems: zod_1.z.boolean().default(false).nullish(),
|
|
40
43
|
crossSellsRedirectItems: zod_1.z.boolean().default(false).nullish(),
|
|
41
44
|
customerAddressNoteEnable: zod_1.z.boolean().nullish(),
|
package/dist/utils/isMonorepo.js
CHANGED
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isMonorepo = isMonorepo;
|
|
7
6
|
exports.findParentPath = findParentPath;
|
|
8
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
@@ -20,33 +19,6 @@ function findPackageJson(directory) {
|
|
|
20
19
|
return null;
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Determines if we're running in a monorepo context and how to handle postinstall scripts.
|
|
25
|
-
*
|
|
26
|
-
* If there is a parent `@graphcommerce/*` package, we're in a monorepo.
|
|
27
|
-
*/
|
|
28
|
-
function isMonorepo() {
|
|
29
|
-
let currentDir = process.cwd();
|
|
30
|
-
log(`Starting directory: ${currentDir}`);
|
|
31
|
-
// Start from the parent directory to find a parent @graphcommerce package
|
|
32
|
-
currentDir = node_path_1.default.dirname(currentDir);
|
|
33
|
-
log(`Looking for parent packages starting from: ${currentDir}`);
|
|
34
|
-
// Keep going up until we find a root package or hit the filesystem root
|
|
35
|
-
while (currentDir !== node_path_1.default.parse(currentDir).root) {
|
|
36
|
-
const packageJson = findPackageJson(currentDir);
|
|
37
|
-
if (packageJson) {
|
|
38
|
-
log(`Found package.json in: ${currentDir}`);
|
|
39
|
-
log(`Package name: ${packageJson.name}`);
|
|
40
|
-
if (packageJson.name.startsWith('@graphcommerce/')) {
|
|
41
|
-
log('isMonorepo result: true (found parent @graphcommerce package)');
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
currentDir = node_path_1.default.dirname(currentDir);
|
|
46
|
-
}
|
|
47
|
-
log('isMonorepo result: false (no parent @graphcommerce package found)');
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
22
|
/**
|
|
51
23
|
* Finds the path of the parent @graphcommerce package if it exists Returns null if no parent
|
|
52
24
|
* package is found
|
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": "9.0.0-canary.
|
|
5
|
+
"version": "9.0.0-canary.110",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "src/index.ts",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
+
import { writeFileSync } from 'fs'
|
|
2
3
|
import { generate } from '@graphql-codegen/cli'
|
|
3
4
|
import { transformFileSync } from '@swc/core'
|
|
4
5
|
import dotenv from 'dotenv'
|
|
5
|
-
import {
|
|
6
|
-
import { isMonorepo } from '../../utils/isMonorepo'
|
|
6
|
+
import { findParentPath } from '../../utils/isMonorepo'
|
|
7
7
|
import { resolveDependenciesSync } from '../../utils/resolveDependenciesSync'
|
|
8
8
|
import { resolveDependency } from '../../utils/resolveDependency'
|
|
9
9
|
|
|
@@ -42,7 +42,7 @@ export async function generateConfig() {
|
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
|
-
...(
|
|
45
|
+
...(findParentPath(process.cwd()) && {
|
|
46
46
|
'../../docs/framework/config.md': {
|
|
47
47
|
plugins: ['@graphcommerce/graphql-codegen-markdown-docs'],
|
|
48
48
|
},
|
package/src/generated/config.ts
CHANGED
|
@@ -25,6 +25,11 @@ export type CompareVariant =
|
|
|
25
25
|
| 'CHECKBOX'
|
|
26
26
|
| 'ICON';
|
|
27
27
|
|
|
28
|
+
/** Configure whether the layout should be full width or should be constrained by a max breakpoint. Configurable in theme.ts */
|
|
29
|
+
export type ContainerSizing =
|
|
30
|
+
| 'BREAKPOINT'
|
|
31
|
+
| 'FULL_WIDTH';
|
|
32
|
+
|
|
28
33
|
export type CustomerAccountPermissions =
|
|
29
34
|
| 'DISABLED'
|
|
30
35
|
| 'DISABLE_REGISTRATION'
|
|
@@ -157,6 +162,10 @@ export type GraphCommerceConfig = {
|
|
|
157
162
|
* Enabling options here will allow switching of those variants.
|
|
158
163
|
*/
|
|
159
164
|
configurableVariantValues?: InputMaybe<MagentoConfigurableVariantValues>;
|
|
165
|
+
/** Configures the max width of the content (main content area) */
|
|
166
|
+
containerSizingContent?: InputMaybe<ContainerSizing>;
|
|
167
|
+
/** Configures the max width of the shell (header, footer, overlays, etc.) */
|
|
168
|
+
containerSizingShell?: InputMaybe<ContainerSizing>;
|
|
160
169
|
/**
|
|
161
170
|
* Determines if cross sell items should be shown when the user already has the product in their cart. This will result in a product will popping off the screen when you add it to the cart.
|
|
162
171
|
*
|
|
@@ -520,6 +529,8 @@ export const CartPermissionsSchema = z.enum(['CUSTOMER_ONLY', 'DISABLED', 'ENABL
|
|
|
520
529
|
|
|
521
530
|
export const CompareVariantSchema = z.enum(['CHECKBOX', 'ICON']);
|
|
522
531
|
|
|
532
|
+
export const ContainerSizingSchema = z.enum(['BREAKPOINT', 'FULL_WIDTH']);
|
|
533
|
+
|
|
523
534
|
export const CustomerAccountPermissionsSchema = z.enum(['DISABLED', 'DISABLE_REGISTRATION', 'ENABLED']);
|
|
524
535
|
|
|
525
536
|
export const PaginationVariantSchema = z.enum(['COMPACT', 'EXTENDED']);
|
|
@@ -545,6 +556,8 @@ export function GraphCommerceConfigSchema(): z.ZodObject<Properties<GraphCommerc
|
|
|
545
556
|
compareVariant: CompareVariantSchema.default("ICON").nullish(),
|
|
546
557
|
configurableVariantForSimple: z.boolean().default(false).nullish(),
|
|
547
558
|
configurableVariantValues: MagentoConfigurableVariantValuesSchema().nullish(),
|
|
559
|
+
containerSizingContent: ContainerSizingSchema.default("FULL_WIDTH").nullish(),
|
|
560
|
+
containerSizingShell: ContainerSizingSchema.default("FULL_WIDTH").nullish(),
|
|
548
561
|
crossSellsHideCartItems: z.boolean().default(false).nullish(),
|
|
549
562
|
crossSellsRedirectItems: z.boolean().default(false).nullish(),
|
|
550
563
|
customerAddressNoteEnable: z.boolean().nullish(),
|
package/src/utils/isMonorepo.ts
CHANGED
|
@@ -15,40 +15,6 @@ function findPackageJson(directory: string): { name: string } | null {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Determines if we're running in a monorepo context and how to handle postinstall scripts.
|
|
20
|
-
*
|
|
21
|
-
* If there is a parent `@graphcommerce/*` package, we're in a monorepo.
|
|
22
|
-
*/
|
|
23
|
-
export function isMonorepo() {
|
|
24
|
-
let currentDir = process.cwd()
|
|
25
|
-
log(`Starting directory: ${currentDir}`)
|
|
26
|
-
|
|
27
|
-
// Start from the parent directory to find a parent @graphcommerce package
|
|
28
|
-
currentDir = path.dirname(currentDir)
|
|
29
|
-
log(`Looking for parent packages starting from: ${currentDir}`)
|
|
30
|
-
|
|
31
|
-
// Keep going up until we find a root package or hit the filesystem root
|
|
32
|
-
while (currentDir !== path.parse(currentDir).root) {
|
|
33
|
-
const packageJson = findPackageJson(currentDir)
|
|
34
|
-
|
|
35
|
-
if (packageJson) {
|
|
36
|
-
log(`Found package.json in: ${currentDir}`)
|
|
37
|
-
log(`Package name: ${packageJson.name}`)
|
|
38
|
-
|
|
39
|
-
if (packageJson.name.startsWith('@graphcommerce/')) {
|
|
40
|
-
log('isMonorepo result: true (found parent @graphcommerce package)')
|
|
41
|
-
return true
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
currentDir = path.dirname(currentDir)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
log('isMonorepo result: false (no parent @graphcommerce package found)')
|
|
49
|
-
return false
|
|
50
|
-
}
|
|
51
|
-
|
|
52
18
|
/**
|
|
53
19
|
* Finds the path of the parent @graphcommerce package if it exists Returns null if no parent
|
|
54
20
|
* package is found
|