Skip to content

Commit

Permalink
Added Adobe Commerce Compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
paales committed Oct 14, 2024
1 parent 2e51fb8 commit 79e78e9
Show file tree
Hide file tree
Showing 11 changed files with 202 additions and 198 deletions.
13 changes: 8 additions & 5 deletions packages/cli/dist/bin/mesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,20 @@ const main = async () => {
const deps = (0, next_config_1.resolveDependenciesSync)();
const packages = [...deps.values()].filter((p) => p !== '.');
const mV = graphCommerce.magentoVersion ?? 246;
(0, next_config_1.sig)();
(0, next_config_1.packageRoots)(packages).forEach((r) => {
conf.additionalTypeDefs.push(`${r}/*/schema/**/*.graphqls`);
const scanVersions = [245, 246, 247, 248, 249, 250, 251, 252, 253, 254]
.filter((v) => v > mV)
.map((v) => `${r}/*/schema-${v}/**/*.graphqls`);
conf.additionalTypeDefs.push(...scanVersions);
const scanVersionAC = [245, 246, 247, 248, 249, 250, 251, 252, 253, 254]
.filter((v) => v > mV)
.map((v) => `${r}/*/schema-ac-${v}/**/*.graphqls`);
conf.additionalTypeDefs.push(...scanVersionAC);
conf.additionalTypeDefs.push(`${r}/*/schema-ac/**/*.graphqls`);
if (globalThis.gcl?.includes(atob('QGdyYXBoY29tbWVyY2UvYWRvYmUtY29tbWVyY2U='))) {
conf.additionalTypeDefs.push(`${r}/*/schema-ac/**/*.graphqls`);
const scanVersionAC = [245, 246, 247, 248, 249, 250, 251, 252, 253, 254]
.filter((v) => v > mV)
.map((v) => `${r}/*/schema-ac-${v}/**/*.graphqls`);
conf.additionalTypeDefs.push(...scanVersionAC);
}
});
if (!conf.serve)
conf.serve = {};
Expand Down
22 changes: 13 additions & 9 deletions packages/cli/src/bin/mesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@
import { promises as fs } from 'node:fs'
import path from 'node:path'
import { exit } from 'node:process'
import type { meshConfig as meshConfigBase } from '@graphcommerce/graphql-mesh/meshConfig'
import {
loadConfig,
packageRoots,
replaceConfigInString,
resolveDependenciesSync,
sig,
} from '@graphcommerce/next-config'
import { graphqlMesh, DEFAULT_CLI_PARAMS, GraphQLMeshCLIParams } from '@graphql-mesh/cli'
import { DEFAULT_CLI_PARAMS, graphqlMesh, GraphQLMeshCLIParams } from '@graphql-mesh/cli'
import { Logger, YamlConfig } from '@graphql-mesh/types'
import { Handler } from '@graphql-mesh/types/typings/config'
import { DefaultLogger } from '@graphql-mesh/utils'
import dotenv from 'dotenv'
import type { OmitIndexSignature, Entries } from 'type-fest'
import type { Entries, OmitIndexSignature } from 'type-fest'
import yaml from 'yaml'
import { findConfig } from '../utils/findConfig'
import type { meshConfig as meshConfigBase } from '@graphcommerce/graphql-mesh/meshConfig'
// eslint-disable-next-line import/no-unresolved
import 'tsx/cjs' // support importing typescript configs in CommonJS
// eslint-disable-next-line import/no-unresolved
Expand Down Expand Up @@ -123,6 +124,8 @@ const main = async () => {
const packages = [...deps.values()].filter((p) => p !== '.')

const mV = graphCommerce.magentoVersion ?? 246
sig()

packageRoots(packages).forEach((r) => {
conf.additionalTypeDefs.push(`${r}/*/schema/**/*.graphqls`)

Expand All @@ -132,12 +135,13 @@ const main = async () => {

conf.additionalTypeDefs.push(...scanVersions)

const scanVersionAC = [245, 246, 247, 248, 249, 250, 251, 252, 253, 254]
.filter((v) => v > mV)
.map((v) => `${r}/*/schema-ac-${v}/**/*.graphqls`)
conf.additionalTypeDefs.push(...scanVersionAC)

conf.additionalTypeDefs.push(`${r}/*/schema-ac/**/*.graphqls`)
if (globalThis.gcl?.includes(atob('QGdyYXBoY29tbWVyY2UvYWRvYmUtY29tbWVyY2U='))) {
conf.additionalTypeDefs.push(`${r}/*/schema-ac/**/*.graphqls`)
const scanVersionAC = [245, 246, 247, 248, 249, 250, 251, 252, 253, 254]
.filter((v) => v > mV)
.map((v) => `${r}/*/schema-ac-${v}/**/*.graphqls`)
conf.additionalTypeDefs.push(...scanVersionAC)
}
})

if (!conf.serve) conf.serve = {}
Expand Down

This file was deleted.

256 changes: 92 additions & 164 deletions packagesDev/next-config/dist/generated/config.js
Original file line number Diff line number Diff line change
@@ -1,195 +1,123 @@
/* eslint-disable */ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
CartPermissionsSchema: function() {
return CartPermissionsSchema;
},
CompareVariantSchema: function() {
return CompareVariantSchema;
},
CustomerAccountPermissionsSchema: function() {
return CustomerAccountPermissionsSchema;
},
DatalayerConfigSchema: function() {
return DatalayerConfigSchema;
},
GraphCommerceConfigSchema: function() {
return GraphCommerceConfigSchema;
},
GraphCommerceDebugConfigSchema: function() {
return GraphCommerceDebugConfigSchema;
},
GraphCommercePermissionsSchema: function() {
return GraphCommercePermissionsSchema;
},
GraphCommerceStorefrontConfigSchema: function() {
return GraphCommerceStorefrontConfigSchema;
},
MagentoConfigurableVariantValuesSchema: function() {
return MagentoConfigurableVariantValuesSchema;
},
PaginationVariantSchema: function() {
return PaginationVariantSchema;
},
ProductFiltersLayoutSchema: function() {
return ProductFiltersLayoutSchema;
},
RecentlyViewedProductsConfigSchema: function() {
return RecentlyViewedProductsConfigSchema;
},
SidebarGalleryConfigSchema: function() {
return SidebarGalleryConfigSchema;
},
SidebarGalleryPaginationVariantSchema: function() {
return SidebarGalleryPaginationVariantSchema;
},
WebsitePermissionsSchema: function() {
return WebsitePermissionsSchema;
},
definedNonNullAnySchema: function() {
return definedNonNullAnySchema;
},
isDefinedNonNullAny: function() {
return isDefinedNonNullAny;
}
});
const _zod = require("zod");
const isDefinedNonNullAny = (v)=>v !== undefined && v !== null;
const definedNonNullAnySchema = _zod.z.any().refine((v)=>isDefinedNonNullAny(v));
const CartPermissionsSchema = _zod.z.enum([
'CUSTOMER_ONLY',
'DISABLED',
'ENABLED'
]);
const CompareVariantSchema = _zod.z.enum([
'CHECKBOX',
'ICON'
]);
const CustomerAccountPermissionsSchema = _zod.z.enum([
'DISABLED',
'DISABLE_REGISTRATION',
'ENABLED'
]);
const PaginationVariantSchema = _zod.z.enum([
'COMPACT',
'EXTENDED'
]);
const ProductFiltersLayoutSchema = _zod.z.enum([
'DEFAULT',
'SIDEBAR'
]);
const SidebarGalleryPaginationVariantSchema = _zod.z.enum([
'DOTS',
'THUMBNAILS_BOTTOM'
]);
const WebsitePermissionsSchema = _zod.z.enum([
'ENABLED'
]);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebsitePermissionsSchema = exports.SidebarGalleryPaginationVariantSchema = exports.ProductFiltersLayoutSchema = exports.PaginationVariantSchema = exports.CustomerAccountPermissionsSchema = exports.CompareVariantSchema = exports.CartPermissionsSchema = exports.definedNonNullAnySchema = exports.isDefinedNonNullAny = void 0;
exports.DatalayerConfigSchema = DatalayerConfigSchema;
exports.GraphCommerceConfigSchema = GraphCommerceConfigSchema;
exports.GraphCommerceDebugConfigSchema = GraphCommerceDebugConfigSchema;
exports.GraphCommercePermissionsSchema = GraphCommercePermissionsSchema;
exports.GraphCommerceStorefrontConfigSchema = GraphCommerceStorefrontConfigSchema;
exports.MagentoConfigurableVariantValuesSchema = MagentoConfigurableVariantValuesSchema;
exports.RecentlyViewedProductsConfigSchema = RecentlyViewedProductsConfigSchema;
exports.SidebarGalleryConfigSchema = SidebarGalleryConfigSchema;
/* eslint-disable */
const zod_1 = require("zod");
const isDefinedNonNullAny = (v) => v !== undefined && v !== null;
exports.isDefinedNonNullAny = isDefinedNonNullAny;
exports.definedNonNullAnySchema = zod_1.z.any().refine((v) => (0, exports.isDefinedNonNullAny)(v));
exports.CartPermissionsSchema = zod_1.z.enum(['CUSTOMER_ONLY', 'DISABLED', 'ENABLED']);
exports.CompareVariantSchema = zod_1.z.enum(['CHECKBOX', 'ICON']);
exports.CustomerAccountPermissionsSchema = zod_1.z.enum(['DISABLED', 'DISABLE_REGISTRATION', 'ENABLED']);
exports.PaginationVariantSchema = zod_1.z.enum(['COMPACT', 'EXTENDED']);
exports.ProductFiltersLayoutSchema = zod_1.z.enum(['DEFAULT', 'SIDEBAR']);
exports.SidebarGalleryPaginationVariantSchema = zod_1.z.enum(['DOTS', 'THUMBNAILS_BOTTOM']);
exports.WebsitePermissionsSchema = zod_1.z.enum(['ENABLED']);
function DatalayerConfigSchema() {
return _zod.z.object({
coreWebVitals: _zod.z.boolean().nullish()
return zod_1.z.object({
coreWebVitals: zod_1.z.boolean().nullish()
});
}
function GraphCommerceConfigSchema() {
return _zod.z.object({
breadcrumbs: _zod.z.boolean().default(false).nullish(),
canonicalBaseUrl: _zod.z.string().min(1),
cartDisplayPricesInclTax: _zod.z.boolean().nullish(),
compare: _zod.z.boolean().nullish(),
compareVariant: CompareVariantSchema.default("ICON").nullish(),
configurableVariantForSimple: _zod.z.boolean().default(false).nullish(),
return zod_1.z.object({
breadcrumbs: zod_1.z.boolean().default(false).nullish(),
canonicalBaseUrl: zod_1.z.string().min(1),
cartDisplayPricesInclTax: zod_1.z.boolean().nullish(),
compare: zod_1.z.boolean().nullish(),
compareVariant: exports.CompareVariantSchema.default("ICON").nullish(),
configurableVariantForSimple: zod_1.z.boolean().default(false).nullish(),
configurableVariantValues: MagentoConfigurableVariantValuesSchema().nullish(),
crossSellsHideCartItems: _zod.z.boolean().default(false).nullish(),
crossSellsRedirectItems: _zod.z.boolean().default(false).nullish(),
customerAddressNoteEnable: _zod.z.boolean().nullish(),
customerCompanyFieldsEnable: _zod.z.boolean().nullish(),
customerDeleteEnabled: _zod.z.boolean().nullish(),
customerXMagentoCacheIdDisable: _zod.z.boolean().nullish(),
crossSellsHideCartItems: zod_1.z.boolean().default(false).nullish(),
crossSellsRedirectItems: zod_1.z.boolean().default(false).nullish(),
customerAddressNoteEnable: zod_1.z.boolean().nullish(),
customerCompanyFieldsEnable: zod_1.z.boolean().nullish(),
customerDeleteEnabled: zod_1.z.boolean().nullish(),
customerXMagentoCacheIdDisable: zod_1.z.boolean().nullish(),
dataLayer: DatalayerConfigSchema().nullish(),
debug: GraphCommerceDebugConfigSchema().nullish(),
demoMode: _zod.z.boolean().default(true).nullish(),
enableGuestCheckoutLogin: _zod.z.boolean().nullish(),
googleAnalyticsId: _zod.z.string().nullish(),
googleRecaptchaKey: _zod.z.string().nullish(),
googleTagmanagerId: _zod.z.string().nullish(),
hygraphEndpoint: _zod.z.string().min(1),
hygraphManagementApi: _zod.z.string().nullish(),
hygraphProjectId: _zod.z.string().nullish(),
hygraphWriteAccessToken: _zod.z.string().nullish(),
limitSsg: _zod.z.boolean().nullish(),
magentoEndpoint: _zod.z.string().min(1),
magentoVersion: _zod.z.number(),
demoMode: zod_1.z.boolean().default(true).nullish(),
enableGuestCheckoutLogin: zod_1.z.boolean().nullish(),
googleAnalyticsId: zod_1.z.string().nullish(),
googleRecaptchaKey: zod_1.z.string().nullish(),
googleTagmanagerId: zod_1.z.string().nullish(),
hygraphEndpoint: zod_1.z.string().min(1),
hygraphManagementApi: zod_1.z.string().nullish(),
hygraphProjectId: zod_1.z.string().nullish(),
hygraphWriteAccessToken: zod_1.z.string().nullish(),
limitSsg: zod_1.z.boolean().nullish(),
magentoEndpoint: zod_1.z.string().min(1),
magentoVersion: zod_1.z.number(),
permissions: GraphCommercePermissionsSchema().nullish(),
previewSecret: _zod.z.string().nullish(),
productFiltersLayout: ProductFiltersLayoutSchema.default("DEFAULT").nullish(),
productFiltersPro: _zod.z.boolean().nullish(),
productListPaginationVariant: PaginationVariantSchema.default("COMPACT").nullish(),
productRoute: _zod.z.string().nullish(),
previewSecret: zod_1.z.string().nullish(),
productFiltersLayout: exports.ProductFiltersLayoutSchema.default("DEFAULT").nullish(),
productFiltersPro: zod_1.z.boolean().nullish(),
productListPaginationVariant: exports.PaginationVariantSchema.default("COMPACT").nullish(),
productRoute: zod_1.z.string().nullish(),
recentlyViewedProducts: RecentlyViewedProductsConfigSchema().nullish(),
robotsAllow: _zod.z.boolean().nullish(),
robotsAllow: zod_1.z.boolean().nullish(),
sidebarGallery: SidebarGalleryConfigSchema().nullish(),
storefront: _zod.z.array(GraphCommerceStorefrontConfigSchema()),
wishlistHideForGuests: _zod.z.boolean().nullish(),
wishlistShowFeedbackMessage: _zod.z.boolean().nullish()
storefront: zod_1.z.array(GraphCommerceStorefrontConfigSchema()),
wishlistHideForGuests: zod_1.z.boolean().nullish(),
wishlistShowFeedbackMessage: zod_1.z.boolean().nullish()
});
}
function GraphCommerceDebugConfigSchema() {
return _zod.z.object({
pluginStatus: _zod.z.boolean().nullish(),
sessions: _zod.z.boolean().nullish(),
webpackCircularDependencyPlugin: _zod.z.boolean().nullish(),
webpackDuplicatesPlugin: _zod.z.boolean().nullish()
return zod_1.z.object({
pluginStatus: zod_1.z.boolean().nullish(),
sessions: zod_1.z.boolean().nullish(),
webpackCircularDependencyPlugin: zod_1.z.boolean().nullish(),
webpackDuplicatesPlugin: zod_1.z.boolean().nullish()
});
}
function GraphCommercePermissionsSchema() {
return _zod.z.object({
cart: CartPermissionsSchema.nullish(),
checkout: CartPermissionsSchema.nullish(),
customerAccount: CustomerAccountPermissionsSchema.nullish(),
website: WebsitePermissionsSchema.nullish()
return zod_1.z.object({
cart: exports.CartPermissionsSchema.nullish(),
checkout: exports.CartPermissionsSchema.nullish(),
customerAccount: exports.CustomerAccountPermissionsSchema.nullish(),
website: exports.WebsitePermissionsSchema.nullish()
});
}
function GraphCommerceStorefrontConfigSchema() {
return _zod.z.object({
canonicalBaseUrl: _zod.z.string().nullish(),
cartDisplayPricesInclTax: _zod.z.boolean().nullish(),
customerCompanyFieldsEnable: _zod.z.boolean().nullish(),
defaultLocale: _zod.z.boolean().nullish(),
domain: _zod.z.string().nullish(),
googleAnalyticsId: _zod.z.string().nullish(),
googleRecaptchaKey: _zod.z.string().nullish(),
googleTagmanagerId: _zod.z.string().nullish(),
hygraphLocales: _zod.z.array(_zod.z.string().min(1)).nullish(),
linguiLocale: _zod.z.string().nullish(),
locale: _zod.z.string().min(1),
magentoStoreCode: _zod.z.string().min(1),
return zod_1.z.object({
canonicalBaseUrl: zod_1.z.string().nullish(),
cartDisplayPricesInclTax: zod_1.z.boolean().nullish(),
customerCompanyFieldsEnable: zod_1.z.boolean().nullish(),
defaultLocale: zod_1.z.boolean().nullish(),
domain: zod_1.z.string().nullish(),
googleAnalyticsId: zod_1.z.string().nullish(),
googleRecaptchaKey: zod_1.z.string().nullish(),
googleTagmanagerId: zod_1.z.string().nullish(),
hygraphLocales: zod_1.z.array(zod_1.z.string().min(1)).nullish(),
linguiLocale: zod_1.z.string().nullish(),
locale: zod_1.z.string().min(1),
magentoStoreCode: zod_1.z.string().min(1),
permissions: GraphCommercePermissionsSchema().nullish(),
robotsAllow: _zod.z.boolean().nullish()
robotsAllow: zod_1.z.boolean().nullish()
});
}
function MagentoConfigurableVariantValuesSchema() {
return _zod.z.object({
content: _zod.z.boolean().nullish(),
gallery: _zod.z.boolean().nullish(),
url: _zod.z.boolean().nullish()
return zod_1.z.object({
content: zod_1.z.boolean().nullish(),
gallery: zod_1.z.boolean().nullish(),
url: zod_1.z.boolean().nullish()
});
}
function RecentlyViewedProductsConfigSchema() {
return _zod.z.object({
enabled: _zod.z.boolean().nullish(),
maxCount: _zod.z.number().nullish()
return zod_1.z.object({
enabled: zod_1.z.boolean().nullish(),
maxCount: zod_1.z.number().nullish()
});
}
function SidebarGalleryConfigSchema() {
return _zod.z.object({
paginationVariant: SidebarGalleryPaginationVariantSchema.nullish()
return zod_1.z.object({
paginationVariant: exports.SidebarGalleryPaginationVariantSchema.nullish()
});
}
1 change: 1 addition & 0 deletions packagesDev/next-config/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./utils/isMonorepo"), exports);
__exportStar(require("./utils/resolveDependenciesSync"), exports);
__exportStar(require("./utils/packageRoots"), exports);
__exportStar(require("./utils/sig"), exports);
__exportStar(require("./withGraphCommerce"), exports);
__exportStar(require("./generated/config"), exports);
__exportStar(require("./config"), exports);
Expand Down

This file was deleted.

Loading

0 comments on commit 79e78e9

Please sign in to comment.