Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/adobe commerce #2385

Merged
merged 12 commits into from
Nov 27, 2024
6 changes: 6 additions & 0 deletions .changeset/clever-fireants-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@graphcommerce/algolia-recommend': patch
'@graphcommerce/algolia-products': patch
---

Added support for Adobe Commerce for Algolia.
5 changes: 5 additions & 0 deletions .changeset/old-dodos-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphcommerce/next-config': minor
---

Added a functionality to copy directories from packages to the project and keep them managed with GraphCommerce
5 changes: 5 additions & 0 deletions .changeset/three-eels-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphcommerce/prettier-config-pwa': patch
---

Enable prettier-plugin-jsdoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ export const productListRenderer: ProductListItemRenderer = {
topRight={<ProductWishlistChip {...props} />}
/>
),
// // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// // @ts-ignore GiftCardProduct is only available in Commerce
// GiftCardProduct: (props) => (
// <ProductListItem {...props} aspectRatio={[1, 1]} />
// ),
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore GiftCardProduct is only available in Commerce
GiftCardProduct: (props) => <ProductListItem {...props} aspectRatio={[1, 1]} />,
}
30 changes: 15 additions & 15 deletions examples/magento-graphcms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
},
"scripts": {
"dev": "concurrently -k -n codegen,next 'graphql-codegen -w' 'next dev'",
"codegen": "graphcommerce codegen-config && graphcommerce codegen-interceptors && mesh build && graphql-codegen",
"build": "graphcommerce codegen-config && graphcommerce codegen-interceptors && mesh build && graphql-codegen && next build && generate-assetlinks",
"codegen": "graphcommerce codegen && mesh build && graphql-codegen",
"build": "graphcommerce codegen && mesh build && graphql-codegen && next build && generate-assetlinks",
"start": "next start",
"tsc:lint": "tsc --noEmit -p .",
"tsc:perf": "NODE_OPTIONS=--max_old_space_size=10000 tsc --noEmit --generateTrace tsctrace --incremental false && npx @typescript/analyze-trace tsctrace",
Expand All @@ -21,7 +21,7 @@
"create-patch": "patch-package --exclude 'package.json$|gql.ts$|interceptor.tsx$'"
},
"dependencies": {
"@apollo/client": "~3.11.8",
"@apollo/client": "~3.11.10",
"@ducanh2912/next-pwa": "9.7.2",
"@emotion/cache": "^11.13.1",
"@emotion/react": "11.12.0",
Expand Down Expand Up @@ -78,22 +78,22 @@
"@graphcommerce/next-config": "9.0.0-canary.105",
"@graphcommerce/next-ui": "9.0.0-canary.105",
"@graphcommerce/react-hook-form": "9.0.0-canary.105",
"@lingui/conf": "4.11.4",
"@lingui/core": "4.11.4",
"@lingui/macro": "4.11.4",
"@lingui/react": "4.11.4",
"@lingui/conf": "4.14.0",
"@lingui/core": "4.14.0",
"@lingui/macro": "4.14.0",
"@lingui/react": "4.14.0",
"@mui/lab": "5.0.0-alpha.173",
"@mui/material": "5.16.7",
"@mui/utils": "^5.16.6",
"@next/env": "14.2.14",
"@next/env": "15.0.3",
"@parcel/watcher": "^2.4.1",
"@unts/patch-package": "^8.0.0",
"concurrently": "8.2.2",
"cross-env": "^7.0.3",
"dotenv": "16.4.5",
"framer-motion": "11.11.1",
"graphql": "^16.9.0",
"next": "14.2.14",
"next": "15.0.3",
"next-assetlinks": "^1.0.0",
"next-sitemap": "4.2.3",
"react": "^18.3.1",
Expand All @@ -107,18 +107,18 @@
"@graphcommerce/eslint-config-pwa": "9.0.0-canary.105",
"@graphcommerce/prettier-config-pwa": "9.0.0-canary.105",
"@graphcommerce/typescript-config-pwa": "9.0.0-canary.105",
"@lingui/cli": "4.11.4",
"@lingui/cli": "4.14.0",
"@playwright/test": "1.47.2",
"@testing-library/react": "^14.3.1",
"@types/node": "^18.19.54",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"@types/node": "^18.19.66",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react-is": "^18.3.0",
"babel-plugin-macros": "^3.1.0",
"eslint": "^8",
"prettier": "3.3.3",
"prettier": "^3",
"type-fest": "^4.26.1",
"typescript": "5.6.2"
"typescript": "5.7.2"
},
"browserslist": [
"> 1% in alt-EU",
Expand Down
30 changes: 15 additions & 15 deletions examples/magento-open-source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
},
"scripts": {
"dev": "concurrently -k -n codegen,next 'graphql-codegen -w' 'next dev'",
"codegen": "graphcommerce codegen-config && graphcommerce codegen-interceptors && mesh build && graphql-codegen",
"build": "graphcommerce codegen-config && graphcommerce codegen-interceptors && mesh build && graphql-codegen && next build && generate-assetlinks",
"codegen": "graphcommerce codegen && mesh build && graphql-codegen",
"build": "graphcommerce codegen && mesh build && graphql-codegen && next build && generate-assetlinks",
"start": "next start",
"tsc:lint": "tsc --noEmit -p .",
"tsc:perf": "NODE_OPTIONS=--max_old_space_size=10000 tsc --noEmit --generateTrace tsctrace --incremental false && npx @typescript/analyze-trace tsctrace",
Expand All @@ -21,7 +21,7 @@
"create-patch": "patch-package --exclude 'package.json$|gql.ts$|interceptor.tsx$'"
},
"dependencies": {
"@apollo/client": "~3.11.8",
"@apollo/client": "~3.11.10",
"@ducanh2912/next-pwa": "9.7.2",
"@emotion/cache": "^11.13.1",
"@emotion/react": "11.12.0",
Expand Down Expand Up @@ -74,22 +74,22 @@
"@graphcommerce/next-config": "9.0.0-canary.105",
"@graphcommerce/next-ui": "9.0.0-canary.105",
"@graphcommerce/react-hook-form": "9.0.0-canary.105",
"@lingui/conf": "4.11.4",
"@lingui/core": "4.11.4",
"@lingui/macro": "4.11.4",
"@lingui/react": "4.11.4",
"@lingui/conf": "4.14.0",
"@lingui/core": "4.14.0",
"@lingui/macro": "4.14.0",
"@lingui/react": "4.14.0",
"@mui/lab": "5.0.0-alpha.173",
"@mui/material": "5.16.7",
"@mui/utils": "^5.16.6",
"@next/env": "14.2.14",
"@next/env": "15.0.3",
"@parcel/watcher": "^2.4.1",
"@unts/patch-package": "^8.0.0",
"concurrently": "8.2.2",
"cross-env": "^7.0.3",
"dotenv": "16.4.5",
"framer-motion": "11.11.1",
"graphql": "^16.9.0",
"next": "14.2.14",
"next": "15.0.3",
"next-assetlinks": "^1.0.0",
"next-sitemap": "4.2.3",
"react": "^18.3.1",
Expand All @@ -103,18 +103,18 @@
"@graphcommerce/eslint-config-pwa": "9.0.0-canary.105",
"@graphcommerce/prettier-config-pwa": "9.0.0-canary.105",
"@graphcommerce/typescript-config-pwa": "9.0.0-canary.105",
"@lingui/cli": "4.11.4",
"@lingui/cli": "4.14.0",
"@playwright/test": "1.47.2",
"@testing-library/react": "^14.3.1",
"@types/node": "^18.19.54",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"@types/node": "^18.19.66",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react-is": "^18.3.0",
"babel-plugin-macros": "^3.1.0",
"eslint": "^8",
"prettier": "3.3.3",
"prettier": "^3",
"type-fest": "^4.26.1",
"typescript": "5.6.2"
"typescript": "5.7.2"
},
"browserslist": [
"> 1% in alt-EU",
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,26 @@
}
},
"dependencies": {
"@changesets/cli": "2.27.9",
"@changesets/cli": "2.27.10",
"@testing-library/jest-dom": "^6.5.0",
"@unts/patch-package": "^8.0.0",
"concurrently": "8.2.2",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@graphql-codegen/testing": "3.0.3",
"@graphql-codegen/testing": "3.0.4",
"@playwright/test": "1.47.2",
"@testing-library/react": "^14.3.1",
"@types/event-stream": "^4.0.5",
"@types/jest": "^29.5.13",
"@types/jest": "^29.5.14",
"eslint": "^8",
"event-stream": "^4.0.1",
"jest": "next",
"jest-diff": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"prettier": "3.3.3",
"typescript": "5.6.2"
"prettier": "^3",
"typescript": "5.7.2"
},
"resolutions": {
"@changesets/assemble-release-plan": "5.2.4",
Expand Down
3 changes: 2 additions & 1 deletion packages/algolia-products/mesh/algoliaHitToMagentoProduct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function algoliaHitToMagentoProduct(
hit: Algoliahit,
storeConfig: GetStoreConfigReturn,
customerGroup: number,
): ProductsItemsItem | null {
): (ProductsItemsItem & { staged: boolean }) | null {
const { objectID, additionalProperties } = hit
if (!assertAdditional(additionalProperties)) return null

Expand Down Expand Up @@ -155,6 +155,7 @@ export function algoliaHitToMagentoProduct(
}

return {
staged: false,
redirect_code: 0,
__typename: algoliaTypeToTypename[type_id as keyof typeof algoliaTypeToTypename],
uid: btoa(objectID),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type GiftCardProduct implements ProductInterface {
algolia_looking_similar(input: AlgoliaLookingSimilarInput): [ProductInterface]
algolia_frequently_bought_together(
input: AlgoliaFrequentlyBoughtTogetherInput
): [ProductInterface]
algolia_related_products(input: AlgoliaRelatedProductsInput): [ProductInterface]
}
2 changes: 2 additions & 0 deletions packages/cli/dist/bin/graphcommerce.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env node
const commands = {
codegen: () => import('@graphcommerce/next-config').then((m) => m.codegen),
"codegen-config": () => import('@graphcommerce/next-config').then((m) => m.generateConfig),
"copy-routes": () => import('@graphcommerce/next-config').then((m) => m.copyFiles),
"codegen-interceptors": () => import('@graphcommerce/next-config').then((m) => m.codegenInterceptors),
"export-config": () => import('@graphcommerce/next-config').then((m) => m.exportConfig),
"hygraph-migrate": () => import('@graphcommerce/hygraph-cli').then((m) => m.migrateHygraph)
Expand Down
18 changes: 12 additions & 6 deletions packages/cli/dist/bin/mesh.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env node
import { loadConfig, resolveDependenciesSync, packageRoots, replaceConfigInString } from '@graphcommerce/next-config';
import { DEFAULT_CLI_PARAMS, graphqlMesh } from '@graphql-mesh/cli';
import { DefaultLogger, defaultImportFn, loadYaml, fileURLToPath } from '@graphql-mesh/utils';
import dotenv from 'dotenv';
import { promises } from 'node:fs';
import path$1 from 'node:path';
import { exit } from 'node:process';
import { loadConfig, resolveDependenciesSync, sig, packageRoots, replaceConfigInString } from '@graphcommerce/next-config';
import { DEFAULT_CLI_PARAMS, graphqlMesh } from '@graphql-mesh/cli';
import { DefaultLogger, defaultImportFn, loadYaml, fileURLToPath } from '@graphql-mesh/utils';
import dotenv from 'dotenv';
import 'tsx/cjs';
import 'tsx/esm';
import yaml from 'yaml';
Expand Down Expand Up @@ -144,10 +144,16 @@ const main = async () => {
const deps = resolveDependenciesSync();
const packages = [...deps.values()].filter((p) => p !== ".");
const mV = graphCommerce.magentoVersion ?? 246;
sig();
packageRoots(packages).forEach((r) => {
const alsoScan = [245, 246, 247, 248, 249, 250, 251, 252, 253, 254].filter((v) => v > mV).map((v) => `${r}/*/schema-${v}/**/*.graphqls`);
conf.additionalTypeDefs.push(`${r}/*/schema/**/*.graphqls`);
conf.additionalTypeDefs.push(...alsoScan);
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);
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 = {};
if (!conf.serve.playgroundTitle) conf.serve.playgroundTitle = "GraphCommerce\xAE Mesh";
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
"mesh": "dist/bin/mesh.js"
},
"dependencies": {
"@graphql-codegen/cli": "5.0.2",
"@graphql-codegen/cli": "5.0.3",
"@graphql-mesh/cli": "latest",
"@graphql-mesh/cross-helpers": "latest",
"@graphql-mesh/runtime": "latest",
"@graphql-mesh/store": "latest",
"@graphql-mesh/types": "latest",
"@graphql-mesh/utils": "latest",
"@graphql-tools/utils": "^10.3.2",
"@graphql-tools/utils": "^10.6.0",
"cosmiconfig": "^8.3.6",
"detect-package-manager": "^3.0.2",
"dotenv": "16.4.5",
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/bin/graphcommerce.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env node

const commands = {
codegen: () => import('@graphcommerce/next-config').then((m) => m.codegen),
'codegen-config': () => import('@graphcommerce/next-config').then((m) => m.generateConfig),
'copy-routes': () => import('@graphcommerce/next-config').then((m) => m.copyFiles),
'codegen-interceptors': () =>
import('@graphcommerce/next-config').then((m) => m.codegenInterceptors),
'export-config': () => import('@graphcommerce/next-config').then((m) => m.exportConfig),
Expand Down
24 changes: 18 additions & 6 deletions packages/cli/src/bin/mesh.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
/* eslint-disable import/no-extraneous-dependencies */
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 type { GraphQLMeshCLIParams } from '@graphql-mesh/cli'
import { DEFAULT_CLI_PARAMS, graphqlMesh } from '@graphql-mesh/cli'
import type { Logger, YamlConfig } from '@graphql-mesh/types'
import { DefaultLogger, fileURLToPath } from '@graphql-mesh/utils'
import dotenv from 'dotenv'
import { promises as fs } from 'node:fs'
import path from 'node:path'
import { exit } from 'node:process'
import 'tsx/cjs'
import 'tsx/esm'
import type { Entries, OmitIndexSignature } from 'type-fest'
Expand Down Expand Up @@ -126,13 +127,24 @@ const main = async () => {
const packages = [...deps.values()].filter((p) => p !== '.')

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

packageRoots(packages).forEach((r) => {
const alsoScan = [245, 246, 247, 248, 249, 250, 251, 252, 253, 254]
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(`${r}/*/schema/**/*.graphqls`)
conf.additionalTypeDefs.push(...alsoScan)
conf.additionalTypeDefs.push(...scanVersions)

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
Loading
Loading