Skip to content

Commit

Permalink
Merge pull request #2380 from graphcommerce-org/fix/various
Browse files Browse the repository at this point in the history
Solve issue with url?.startsWith and various others
  • Loading branch information
paales authored Nov 18, 2024
2 parents 8dcf163 + 355a9ac commit 6087e4d
Show file tree
Hide file tree
Showing 77 changed files with 4,432 additions and 4,286 deletions.
5 changes: 5 additions & 0 deletions .changeset/cool-moose-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphcommerce/magento-customer': patch
---

Solve issue where persisted Form-data would remain in the sessionStorage after logging out.
12 changes: 12 additions & 0 deletions .changeset/cuddly-tips-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@graphcommerce/next-config': minor
'@graphcommerce/graphql-mesh': minor
---

Solves the issue `TypeError: url?.startsWith is not a function`. The generated `.mesh/index.ts` would be generated as a requirejs module while next.js expects an esm module. In the end we properly generated the mesh correctly and now there is an `import.meta.url` instead of using `require('node:url')`. To solve this we needed to solve a chain of issues:

1. The generation of the mesh is based on the version of the mesh that is imported (esm or commonjs). See [source](https://github.com/ardatan/graphql-mesh/blob/bf588d372c0078378aaa24beea2da794af7949e6/scripts/replace-import-meta-url-in-cjs.ts#L9-L10) for the lines that need to be different. This meant that we needed to change the @graphcommerce/cli package to be of type:module instead of a commonjs module.

2) To properly convert the module to an esm module we've migrated the build of the cli package to use 'pkgroll' instead of tsc, because tsc is limited in what it outputs and can't really convert classic imports to esm.

3) To load possible mesh plugins we require additional .ts files to be loaded with [tsx](https://tsx.is/). To get the tsx loader to work properly in combination with esm modules, we need at least [node 18.19.0](https://nodejs.org/en/blog/release/v18.19.0#new-nodemodule-api-register-for-module-customization-hooks-new-initialize-hook). Minimal Node version upped to 18.19.0 and add support for node 22.
6 changes: 6 additions & 0 deletions .changeset/nasty-coins-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@graphcommerce/magento-search': patch
'@graphcommerce/ecommerce-ui': patch
---

Solve issue: Warning: Cannot update a component (`FormAutoSubmitBase`) while rendering a different component (`ActionCardListForm`).
5 changes: 5 additions & 0 deletions .changeset/odd-mails-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphcommerce/magento-customer': patch
---

Remove the inContext directive from the query before sending to the server
5 changes: 5 additions & 0 deletions .changeset/pink-students-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphcommerce/next-ui': patch
---

Solve an issue where internal full URL's would cause prefetching errors and would use a hard navigation.
5 changes: 5 additions & 0 deletions .changeset/rotten-pots-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphcommerce/graphql': patch
---

measurePerformanceLink now reports queries made in the subgraph and is only included during development and not in production.
4 changes: 4 additions & 0 deletions docs/framework/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ Issues that this can cause are:

### GraphCommercePermissions

Permissions input

#### cart: CUSTOMER_ONLY | DISABLED | ENABLED

Changes the availability of the add to cart buttons and the cart page to either customer only or completely disables it.
Expand All @@ -386,6 +388,8 @@ Enables / disabled the account section of the website. DISABLE_REGISTRATION will

#### website: ENABLED

Allows the option to require login or completely disable the site.

### GraphCommerceStorefrontConfig

All storefront configuration for the project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function RowColumnTwoSpread(props: RowColumnTwoFragment) {
{...props}
nodeLength={
getNodeLength(colOne.raw as ElementOrTextNode) >=
getNodeLength(colTwo.raw as ElementOrTextNode) ?? false
getNodeLength(colTwo.raw as ElementOrTextNode)
}
colOneContent={
<RichText
Expand Down
2 changes: 1 addition & 1 deletion examples/magento-graphcms/lib/graphql/graphqlSsrClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function client(context: GetStaticPropsContext, fetchPolicy: FetchPolicy = 'no-c

return new ApolloClient({
link: ApolloLink.from([
measurePerformanceLink,
...(process.env.NODE_ENV === 'production' ? [measurePerformanceLink] : []),
errorLink,
...config.links,
new MeshApolloLink(getBuiltMesh()),
Expand Down
42 changes: 23 additions & 19 deletions examples/magento-graphcms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"sideEffects": false,
"packageManager": "[email protected]",
"engines": {
"node": "16.x.x||18.x.x||20.x.x"
"node": ">=18.19.0 <22.0.0"
},
"scripts": {
"dev": "concurrently -k -n codegen,next 'graphql-codegen -w' 'next dev'",
Expand All @@ -20,7 +20,7 @@
"create-patch": "patch-package --exclude 'package.json$|gql.ts$|interceptor.tsx$'"
},
"dependencies": {
"@apollo/client": "~3.10.8",
"@apollo/client": "~3.11.8",
"@ducanh2912/next-pwa": "9.7.2",
"@graphcommerce/cli": "9.0.0-canary.100",
"@graphcommerce/demo-magento-graphcommerce": "9.0.0-canary.100",
Expand Down Expand Up @@ -70,49 +70,53 @@
"@graphcommerce/next-config": "9.0.0-canary.100",
"@graphcommerce/next-ui": "9.0.0-canary.100",
"@graphcommerce/react-hook-form": "9.0.0-canary.100",
"@lingui/conf": "4.11.2",
"@lingui/core": "4.11.2",
"@lingui/macro": "4.11.2",
"@lingui/react": "4.11.2",
"@mui/lab": "5.0.0-alpha.171",
"@mui/material": "5.16.4",
"@next/env": "14.2.5",
"@lingui/conf": "4.11.4",
"@lingui/core": "4.11.4",
"@lingui/macro": "4.11.4",
"@lingui/react": "4.11.4",
"@mui/lab": "5.0.0-alpha.173",
"@mui/material": "5.16.7",
"@mui/utils": "^5.16.6",
"@next/env": "14.2.14",
"@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": "10.18.0",
"framer-motion": "11.11.1",
"graphql": "^16.9.0",
"next": "14.2.5",
"next": "14.2.14",
"next-assetlinks": "^1.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.52.1",
"sharp": "0.33.4",
"react-hook-form": "^7.53.0",
"sharp": "0.33.5",
"ts-node": "^10.9.2",
"webpack": "~5.93.0"
},
"devDependencies": {
"@graphcommerce/eslint-config-pwa": "9.0.0-canary.100",
"@graphcommerce/prettier-config-pwa": "9.0.0-canary.100",
"@graphcommerce/typescript-config-pwa": "9.0.0-canary.100",
"@lingui/cli": "4.11.2",
"@playwright/test": "1.45.1",
"@types/node": "^18.19.40",
"@types/react": "^18.3.3",
"@lingui/cli": "4.11.4",
"@playwright/test": "1.47.2",
"@types/node": "^18.19.54",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"@types/react-is": "^18.3.0",
"babel-plugin-macros": "^3.1.0",
"eslint": "^8",
"prettier": "3.3.3",
"type-fest": "^4.22.0",
"typescript": "5.5.3"
"type-fest": "^4.26.1",
"typescript": "5.6.2"
},
"browserslist": [
"> 1% in alt-EU",
"not IE 11"
],
"resolutions": {
"@emotion/react": "11.12.0"
},
"prettier": "@graphcommerce/prettier-config-pwa",
"eslintConfig": {
"extends": "@graphcommerce/eslint-config-pwa",
Expand Down

This file was deleted.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"examples/*"
],
"engines": {
"node": "16.x.x||18.x.x||20.x.x"
"node": ">=18.19.0 <23.0.0"
},
"scripts": {
"eslint:lint": "eslint --ignore-path .gitignore '**/{*.ts,*.tsx}'",
Expand Down Expand Up @@ -46,8 +46,8 @@
}
},
"dependencies": {
"@changesets/cli": "2.27.7",
"@testing-library/jest-dom": "^6.4.6",
"@changesets/cli": "2.27.9",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^14.3.1",
"@unts/patch-package": "^8.0.0",
"concurrently": "8.2.2",
Expand All @@ -56,20 +56,20 @@
},
"devDependencies": {
"@graphql-codegen/testing": "3.0.3",
"@playwright/test": "1.45.1",
"@playwright/test": "1.47.2",
"@types/event-stream": "^4.0.5",
"@types/jest": "^29.5.12",
"@types/jest": "^29.5.13",
"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.5.3"
"typescript": "5.6.2"
},
"resolutions": {
"@changesets/assemble-release-plan": "5.2.4",
"@changesets/config": "2.3.1",
"@graphql-tools/delegate": "10.0.13"
"@emotion/react": "11.12.0"
}
}
4 changes: 2 additions & 2 deletions packages/algolia-categories/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"react": "^18.2.0"
},
"devDependencies": {
"graphql": "^16.0.0",
"tsx": "^4.16.2"
"graphql": "^16.9.0",
"tsx": "^4.19.1"
}
}
4 changes: 2 additions & 2 deletions packages/algolia-insights/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"react": "^18.2.0"
},
"devDependencies": {
"graphql": "^16.0.0",
"tsx": "^4.16.2"
"graphql": "^16.9.0",
"tsx": "^4.19.1"
}
}
4 changes: 2 additions & 2 deletions packages/algolia-personalization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"react": "^18.2.0"
},
"devDependencies": {
"graphql": "^16.0.0",
"tsx": "^4.16.2"
"graphql": "^16.9.0",
"tsx": "^4.19.1"
}
}
4 changes: 2 additions & 2 deletions packages/algolia-products/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"react": "^18.2.0"
},
"devDependencies": {
"graphql": "^16.0.0",
"tsx": "^4.16.2"
"graphql": "^16.9.0",
"tsx": "^4.19.1"
}
}
4 changes: 2 additions & 2 deletions packages/algolia-recommend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"react": "^18.2.0"
},
"devDependencies": {
"graphql": "^16.0.0",
"tsx": "^4.16.2"
"graphql": "^16.9.0",
"tsx": "^4.19.1"
}
}
Loading

0 comments on commit 6087e4d

Please sign in to comment.