@graphcommerce/docs 4.4.3 → 4.5.2
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 +22 -0
- package/framework/deployment.md +4 -0
- package/framework/environment-variables.md +4 -0
- package/framework/graphcms.md +4 -0
- package/framework/icons.md +4 -0
- package/framework/readme.md +4 -0
- package/framework/static-generation.md +4 -0
- package/framework/troubleshooting.md +4 -0
- package/getting-started/create.md +11 -9
- package/getting-started/graphcms-component.md +5 -1
- package/getting-started/header.md +6 -7
- package/getting-started/pages.md +4 -2
- package/getting-started/readme.md +4 -0
- package/getting-started/start-building.md +4 -0
- package/getting-started/vscode.md +8 -14
- package/package.json +1 -1
- package/readme.md +6 -2
- package/roadmap.md +1 -1
- package/upgrading.md +120 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1354](https://github.com/graphcommerce-org/graphcommerce/pull/1354) [`90fa8d8b9`](https://github.com/graphcommerce-org/graphcommerce/commit/90fa8d8b90e2a3b33cdbb178a87094888c7befdd) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Small fixes to docs
|
|
8
|
+
|
|
9
|
+
## 4.5.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1347](https://github.com/graphcommerce-org/graphcommerce/pull/1347) [`31f463d5c`](https://github.com/graphcommerce-org/graphcommerce/commit/31f463d5c2edff45911b63b1d89e5857244c1754) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Upgrading
|
|
14
|
+
|
|
15
|
+
## 4.5.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#1341](https://github.com/graphcommerce-org/graphcommerce/pull/1341) [`a06c86706`](https://github.com/graphcommerce-org/graphcommerce/commit/a06c86706c8b76ce91cfa1e526fe16aa20c53991) Thanks [@paales](https://github.com/paales)! - Added upgrade instructions
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#1338](https://github.com/graphcommerce-org/graphcommerce/pull/1338) [`a8886ce4c`](https://github.com/graphcommerce-org/graphcommerce/commit/a8886ce4c059e85b83158b4bc1d8e2f04626d49f) Thanks [@paales](https://github.com/paales)! - Docs improvements
|
|
24
|
+
|
|
3
25
|
## 4.4.3
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/framework/deployment.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
<div data-nosnippet>
|
|
2
|
+
|
|
1
3
|
> **Developer preview**
|
|
2
4
|
> This is a developer preview of GraphCommerce. The documentation will be
|
|
3
5
|
> updated as GraphCommerce introduces
|
|
4
6
|
> [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
|
|
5
7
|
|
|
8
|
+
</div>
|
|
9
|
+
|
|
6
10
|
# Deploy a Graphcommerce app with Vercel
|
|
7
11
|
|
|
8
12
|
Congratulations, you are ready to deploy your GraphCommerce storefront to
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
<div data-nosnippet>
|
|
2
|
+
|
|
1
3
|
> **Developer preview**
|
|
2
4
|
> This is a developer preview of GraphCommerce. The documentation will be
|
|
3
5
|
> updated as GraphCommerce introduces
|
|
4
6
|
> [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
|
|
5
7
|
|
|
8
|
+
</div>
|
|
9
|
+
|
|
6
10
|
# Environment Variables
|
|
7
11
|
|
|
8
12
|
This guide describes how to store environment variables in your GraphCommerce
|
package/framework/graphcms.md
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
menu: GraphCMS
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
+
<div data-nosnippet>
|
|
6
|
+
|
|
5
7
|
> **Developer preview**
|
|
6
8
|
> This is a developer preview of GraphCommerce. The documentation will be
|
|
7
9
|
> updated as GraphCommerce introduces
|
|
8
10
|
> [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
|
|
9
11
|
|
|
12
|
+
</div>
|
|
13
|
+
|
|
10
14
|
# GraphCMS
|
|
11
15
|
|
|
12
16
|
GraphCMS is integrated as a Content Management System. It is used to store all
|
package/framework/icons.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
<div data-nosnippet>
|
|
2
|
+
|
|
1
3
|
> **Developer preview**
|
|
2
4
|
> This is a developer preview of GraphCommerce. The documentation will be
|
|
3
5
|
> updated as GraphCommerce introduces
|
|
4
6
|
> [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
|
|
5
7
|
|
|
8
|
+
</div>
|
|
9
|
+
|
|
6
10
|
# Icons
|
|
7
11
|
|
|
8
12
|
The GraphCommerce UI looks clean and minimalistic due to the use of icons. This
|
package/framework/readme.md
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
menu: Overview
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
+
<div data-nosnippet>
|
|
6
|
+
|
|
5
7
|
> **Developer preview**
|
|
6
8
|
> This is a developer preview of GraphCommerce. The documentation will be
|
|
7
9
|
> updated as GraphCommerce introduces
|
|
8
10
|
> [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
|
|
9
11
|
|
|
12
|
+
</div>
|
|
13
|
+
|
|
10
14
|
# GraphCommerce framework overview
|
|
11
15
|
|
|
12
16
|
GraphCommerce is a front-end framework used for building headless Magento
|
|
@@ -6,11 +6,15 @@ metaDescription:
|
|
|
6
6
|
Generation for Magento nextjs PWA out-of-the-box.'
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
<div data-nosnippet>
|
|
10
|
+
|
|
9
11
|
> **Developer preview**
|
|
10
12
|
> This is a developer preview of GraphCommerce. The documentation will be
|
|
11
13
|
> updated as GraphCommerce introduces
|
|
12
14
|
> [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
|
|
13
15
|
|
|
16
|
+
</div>
|
|
17
|
+
|
|
14
18
|
# Static Site Generation (SSG) in GraphCommerce
|
|
15
19
|
|
|
16
20
|
Pages that export a function called getStaticProps, will pre-render at
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
<div data-nosnippet>
|
|
2
|
+
|
|
1
3
|
> **Developer preview**
|
|
2
4
|
> This is a developer preview of GraphCommerce. The documentation will be
|
|
3
5
|
> updated as GraphCommerce introduces
|
|
4
6
|
> [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
|
|
5
7
|
|
|
8
|
+
</div>
|
|
9
|
+
|
|
6
10
|
# Troubleshouting
|
|
7
11
|
|
|
8
12
|
## Common build errors
|
|
@@ -65,14 +65,13 @@ https://user-images.githubusercontent.com/1251986/158647122-dc57002f-a9c2-4661-a
|
|
|
65
65
|
|
|
66
66
|
### Download the example
|
|
67
67
|
|
|
68
|
-
1. `git clone git@github.com:graphcommerce-org/graphcommerce.git
|
|
68
|
+
1. `git clone git@github.com:graphcommerce-org/graphcommerce.git`
|
|
69
69
|
2. `mkdir my-project`
|
|
70
70
|
3. `cp -R graphcommerce/examples/magento-graphcms/. my-project`
|
|
71
|
-
4. `
|
|
72
|
-
5. `
|
|
73
|
-
6. `
|
|
74
|
-
7. `rm
|
|
75
|
-
8. `rm -rf node_modules && rm -rf .next`
|
|
71
|
+
4. `cd my-project`
|
|
72
|
+
5. `cp -R .env.example .env`
|
|
73
|
+
6. `rm CHANGELOG.md`
|
|
74
|
+
7. `rm -rf node_modules && rm -rf .next`
|
|
76
75
|
|
|
77
76
|
Edit /package.json. Delete `"scripts": {...}` and rename `scripts_local` to
|
|
78
77
|
`scripts`:
|
|
@@ -99,7 +98,7 @@ Edit /package.json. Delete `"scripts": {...}` and rename `scripts_local` to
|
|
|
99
98
|
To order to be able to connect your GraphCommerce app to your Magento backend
|
|
100
99
|
and/or GraphCMS project, you'll need:
|
|
101
100
|
|
|
102
|
-
- Magento 2.4.3 - Clean install,
|
|
101
|
+
- Magento 2.4.3 - Clean install, a production or a development environment
|
|
103
102
|
- GraphCMS - A GraphCMS project with the required schema.
|
|
104
103
|
[Clone the demo GraphCMS project ↗](https://app.graphcms.com/clone/caddaa93cfa9436a9e76ae9c0F34d257)
|
|
105
104
|
as your starting point.
|
|
@@ -142,7 +141,7 @@ added as a result, with the exception of the first option in the list.
|
|
|
142
141
|
### Remove unused PSP's
|
|
143
142
|
|
|
144
143
|
The example has Payment Service Providers integrated (Mollie, Braintree). Remove
|
|
145
|
-
the ones
|
|
144
|
+
the ones your Magento backend doesn't support.
|
|
146
145
|
|
|
147
146
|
- Remove `"@graphcommerce/[psp]"` from package.json
|
|
148
147
|
- Remove all [psp] references from `pages/checkout/payment.tsx`
|
|
@@ -156,7 +155,10 @@ the ones you don't want to use.
|
|
|
156
155
|
Visit the development environment running at http://localhost:3000
|
|
157
156
|
Visit the GraphQL Playground running at http://localhost:3000/api/graphql
|
|
158
157
|
|
|
159
|
-
> No success? Refer to [common build errors](../framework/troubleshooting.md)
|
|
158
|
+
> No success? Refer to [common build errors](../framework/troubleshooting.md) or
|
|
159
|
+
> ask your question in the public
|
|
160
|
+
> [Slack community ↗](https://join.slack.com/t/graphcommerce/shared_invite/zt-11rmgq1ad-F~0daNtKcSvtcC4eQRzjeQ)
|
|
161
|
+
> chat
|
|
160
162
|
|
|
161
163
|
## Next steps
|
|
162
164
|
|
|
@@ -3,11 +3,15 @@ menu: 5. Build a GraphCMS component
|
|
|
3
3
|
metaTitle: Build a GraphCMS component
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
<div data-nosnippet>
|
|
7
|
+
|
|
6
8
|
> **Developer preview**
|
|
7
9
|
> This is a developer preview of GraphCommerce. The documentation will be
|
|
8
10
|
> updated as GraphCommerce introduces
|
|
9
11
|
> [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
|
|
10
12
|
|
|
13
|
+
</div>
|
|
14
|
+
|
|
11
15
|
# Build a GraphCMS component
|
|
12
16
|
|
|
13
17
|
Previously, you created a GraphCommerce app and started building a custom
|
|
@@ -45,7 +49,7 @@ frontend React framework that uses Next.js for server-side rendering.
|
|
|
45
49
|
|
|
46
50
|
<figure>
|
|
47
51
|
|
|
48
|
-
![Adding a Single line text field]()
|
|
52
|
+

|
|
49
53
|
|
|
50
54
|
<figcaption>Adding a Single line text field called "Identity"</figcaption>
|
|
51
55
|
</figure>
|
|
@@ -3,11 +3,15 @@ menu: 3. Build a custom header
|
|
|
3
3
|
metaTitle: Build a custom header
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
<div data-nosnippet>
|
|
7
|
+
|
|
6
8
|
> **Developer preview**
|
|
7
9
|
> This is a developer preview of GraphCommerce. The documentation will be
|
|
8
10
|
> updated as GraphCommerce introduces
|
|
9
11
|
> [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
|
|
10
12
|
|
|
13
|
+
</div>
|
|
14
|
+
|
|
11
15
|
# Build a custom header in GraphCommerce
|
|
12
16
|
|
|
13
17
|
Previously, you created a GraphCommerce app and started building your custom
|
|
@@ -101,8 +105,8 @@ https://user-images.githubusercontent.com/1251986/154979091-89c72d68-c62f-451c-a
|
|
|
101
105
|
|
|
102
106
|
### Replace Search input with Search Fab
|
|
103
107
|
|
|
104
|
-
- In /components/Layout/LayoutFull.tsx, replace
|
|
105
|
-
|
|
108
|
+
- In /components/Layout/LayoutFull.tsx, replace `<SearchLink href='/search' />`
|
|
109
|
+
with:
|
|
106
110
|
|
|
107
111
|
```tsx
|
|
108
112
|
<PageLink href='/search' passHref>
|
|
@@ -144,11 +148,6 @@ https://user-images.githubusercontent.com/1251986/154979091-89c72d68-c62f-451c-a
|
|
|
144
148
|
|
|
145
149
|
- Make a copy of /node_modules/@graphcommerce/next-ui/LayoutParts/MenuFab.tsx
|
|
146
150
|
and move it to the directory /components/Layout/MenuFab.tsx
|
|
147
|
-
- In /components/Layout/MenuFab.tsx, change
|
|
148
|
-
`const MotionDiv = styled(m.div)({})` to:
|
|
149
|
-
```ts
|
|
150
|
-
const MotionDiv = styled('div')({})
|
|
151
|
-
```
|
|
152
151
|
- Remove the `style={{...}}` prop from both the `<MotionDiv>` components to
|
|
153
152
|
remove the Fab scroll animation
|
|
154
153
|
- Remove `const { opacity, scale, shadowOpacity } = useFabAnimation()`
|
package/getting-started/pages.md
CHANGED
|
@@ -3,11 +3,15 @@ menu: 4. Build pages
|
|
|
3
3
|
metaTitle: Build pages
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
<div data-nosnippet>
|
|
7
|
+
|
|
6
8
|
> **Developer preview**
|
|
7
9
|
> This is a developer preview of GraphCommerce. The documentation will be
|
|
8
10
|
> updated as GraphCommerce introduces
|
|
9
11
|
> [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
|
|
10
12
|
|
|
13
|
+
</div>
|
|
14
|
+
|
|
11
15
|
# Build pages in GraphCommerce
|
|
12
16
|
|
|
13
17
|
Previously, you created a custom storefront and started customizing your
|
|
@@ -102,7 +106,6 @@ export const getStaticProps: GetPageStaticProps = async (context) => {
|
|
|
102
106
|
...(await page).data,
|
|
103
107
|
apolloState: await conf.then(() => client.cache.extract()),
|
|
104
108
|
},
|
|
105
|
-
revalidate: 60 * 20,
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
```
|
|
@@ -209,7 +212,6 @@ export const getStaticProps: GetPageStaticProps = async (context) => {
|
|
|
209
212
|
...(await page).data,
|
|
210
213
|
apolloState: await conf.then(() => client.cache.extract()),
|
|
211
214
|
},
|
|
212
|
-
revalidate: 60 * 20,
|
|
213
215
|
}
|
|
214
216
|
}
|
|
215
217
|
```
|
|
@@ -9,11 +9,15 @@ metaDescription:
|
|
|
9
9
|
template for Magento storefronts'
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
+
<div data-nosnippet>
|
|
13
|
+
|
|
12
14
|
> **Developer preview**
|
|
13
15
|
> This is a developer preview of GraphCommerce. The documentation will be
|
|
14
16
|
> updated as GraphCommerce introduces
|
|
15
17
|
> [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
|
|
16
18
|
|
|
19
|
+
</div>
|
|
20
|
+
|
|
17
21
|
# GraphCommerce magento-graphcms example overview
|
|
18
22
|
|
|
19
23
|
GraphCommerce offers a magento-graphcms example that provides an approachable
|
|
@@ -3,11 +3,15 @@ menu: 2. Customize a storefront
|
|
|
3
3
|
metaTitle: Customize a storefront
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
<div data-nosnippet>
|
|
7
|
+
|
|
6
8
|
> **Developer preview**
|
|
7
9
|
> This is a developer preview of GraphCommerce. The documentation will be
|
|
8
10
|
> updated as GraphCommerce introduces
|
|
9
11
|
> [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
|
|
10
12
|
|
|
13
|
+
</div>
|
|
14
|
+
|
|
11
15
|
# Start building a GraphCommerce custom storefront
|
|
12
16
|
|
|
13
17
|
Previously, you [created a new GraphCommerce app](../getting-started/create.md).
|
|
@@ -13,7 +13,7 @@ as GraphCommerce. Visual Studio Code is free and available on all platforms.
|
|
|
13
13
|
This guide covers which useful VS Code extensions to install for an optimal
|
|
14
14
|
development experience.
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Required extensions
|
|
17
17
|
|
|
18
18
|
- [ESLint ↗](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) -
|
|
19
19
|
Linter tool for identifying and reporting on patterns in JavaScript
|
|
@@ -22,24 +22,18 @@ Recommended extensions
|
|
|
22
22
|
- [GraphQL ↗](https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql) -
|
|
23
23
|
Adds syntax highlighting, validation, hover information and autocompletion for
|
|
24
24
|
graphql files
|
|
25
|
+
- [Yaml ↗](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml)
|
|
26
|
+
|
|
27
|
+
Recommended extensions:
|
|
28
|
+
|
|
25
29
|
- [DotENV ↗](https://marketplace.visualstudio.com/items?itemName=mikestead.dotenv) -
|
|
26
30
|
Adds support for dotenv file syntax
|
|
27
|
-
- [JavaScript Booster ↗](https://marketplace.visualstudio.com/items?itemName=sburg.vscode-javascript-booster) -
|
|
28
|
-
Advanced JavaScript/TypeScript refactorings and commands
|
|
29
31
|
- [gettext ↗](https://marketplace.visualstudio.com/items?itemName=mrorz.language-gettext) -
|
|
30
32
|
Adds syntax highlight to po translation files
|
|
31
|
-
|
|
32
|
-
Optional extentions
|
|
33
|
-
|
|
34
|
-
- [Color Highlight ↗](https://marketplace.visualstudio.com/items?itemName=naumovs.color-highlight)
|
|
35
|
-
- [Material Theme ↗](https://marketplace.visualstudio.com/items?itemName=Equinusocio.vsc-material-theme)
|
|
36
|
-
- [Material Theme Icons ↗](https://marketplace.visualstudio.com/items?itemName=Equinusocio.vsc-material-theme-icons)
|
|
37
|
-
- [Output Colorizer ↗](https://marketplace.visualstudio.com/items?itemName=IBM.output-colorizer)
|
|
38
|
-
- [Readability Check ↗](https://marketplace.visualstudio.com/items?itemName=jemcclin.readabilitycheck)
|
|
39
33
|
- [Github Actions ↗](https://marketplace.visualstudio.com/items?itemName=me-dutour-mathieu.vscode-github-actions)
|
|
40
|
-
- [
|
|
41
|
-
|
|
42
|
-
- [
|
|
34
|
+
- [JavaScript Booster ↗](https://marketplace.visualstudio.com/items?itemName=sburg.vscode-javascript-booster) -
|
|
35
|
+
Advanced JavaScript/TypeScript refactorings and commands
|
|
36
|
+
- [Color Highlight ↗](https://marketplace.visualstudio.com/items?itemName=naumovs.color-highlight)
|
|
43
37
|
|
|
44
38
|
## Next steps
|
|
45
39
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/docs",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/docs",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce/docs",
|
|
5
|
-
"version": "4.
|
|
5
|
+
"version": "4.5.2",
|
|
6
6
|
"sideEffects": true,
|
|
7
7
|
"devDependencies": {
|
|
8
8
|
"@graphcommerce/prettier-config-pwa": "^4.0.2"
|
package/readme.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
menu: Overview
|
|
3
|
-
order: getting-started,framework, contributing, roadmap
|
|
3
|
+
order: getting-started,framework, upgrading, contributing, roadmap
|
|
4
4
|
metaTitle: Start React, Next.js Magento PWA development here - GraphCommerce
|
|
5
5
|
metaDescription:
|
|
6
6
|
'GraphCommerce is the open-source PWA Studio Magento 2 alternative.
|
|
@@ -8,11 +8,15 @@ metaDescription:
|
|
|
8
8
|
extension.'
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
+
<div data-nosnippet>
|
|
12
|
+
|
|
11
13
|
> **Developer preview**
|
|
12
14
|
> This is a developer preview of GraphCommerce. The documentation will be
|
|
13
15
|
> updated as GraphCommerce introduces
|
|
14
16
|
> [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
|
|
15
17
|
|
|
18
|
+
</div>
|
|
19
|
+
|
|
16
20
|
# GraphCommerce
|
|
17
21
|
|
|
18
22
|
GraphCommerce is a front-end framework used for building headless Magento
|
|
@@ -40,7 +44,7 @@ https://user-images.githubusercontent.com/1251986/154977573-4015e77c-43e7-481e-a
|
|
|
40
44
|
- Nextjs
|
|
41
45
|
- GraphQL
|
|
42
46
|
- Mui
|
|
43
|
-
- Apollo
|
|
47
|
+
- Apollo Client
|
|
44
48
|
- GraphQL Code Generator
|
|
45
49
|
- Framer Motion
|
|
46
50
|
|
package/roadmap.md
CHANGED
|
@@ -11,7 +11,7 @@ The following overview contains the status of items on the GraphCommerce roadmap
|
|
|
11
11
|
|
|
12
12
|
- [x] Framework updates (Mui5)
|
|
13
13
|
- [x] Translation updates (DE, NL, ES, FR, IT)
|
|
14
|
-
- [
|
|
14
|
+
- [x] Documentation and installation guide
|
|
15
15
|
- [ ] Quality improvements (Reduce components, naming)
|
|
16
16
|
|
|
17
17
|
## Planned
|
package/upgrading.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<div data-nosnippet>
|
|
2
|
+
|
|
3
|
+
> **Developer preview**
|
|
4
|
+
> This is a developer preview of GraphCommerce. The documentation will be
|
|
5
|
+
> updated as GraphCommerce introduces
|
|
6
|
+
> [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
|
|
7
|
+
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
# Upgrading
|
|
11
|
+
|
|
12
|
+
This guide describes how to upgrade your GraphCommerce project files and its
|
|
13
|
+
dependencies, while keeping your customizations.
|
|
14
|
+
|
|
15
|
+
### After you've finished this upgrading guide, you'll have accomplished the following:
|
|
16
|
+
|
|
17
|
+
- Created a changes.patch file and applied it to your project
|
|
18
|
+
- Upgraded all dependencies to the latest version
|
|
19
|
+
- Incorporated all the latest changes in your project, while keeping your
|
|
20
|
+
customizations
|
|
21
|
+
|
|
22
|
+
## Step 1: Creating and applying a patch file
|
|
23
|
+
|
|
24
|
+
1. In package.json, find your version:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
// Example from package.json
|
|
28
|
+
|
|
29
|
+
{
|
|
30
|
+
"dependencies": {
|
|
31
|
+
//...
|
|
32
|
+
"@graphcommerce/next-ui": "^4.2.0"
|
|
33
|
+
//...
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. Download a fresh copy of the repository:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git clone git@github.com:graphcommerce-org/graphcommerce.git upgrade
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
3. Navigate to the /upgrade directory you've just created. Run the following
|
|
45
|
+
command, but replace `OLD_VERSION` with your version of
|
|
46
|
+
`@graphcommerce/next-ui`:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
git diff --relative=examples/magento-graphcms "@graphcommerce/next-ui@OLD_VERSION" examples/magento-graphcms ':!examples/magento-graphcms/CHANGELOG.md' > changes.patch
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
4. Move the `changes.patch` file from the /upgrade directory to the root of your
|
|
53
|
+
project.
|
|
54
|
+
|
|
55
|
+
5. Apply the patch to your project (It's recommended to apply changes on a new
|
|
56
|
+
branch):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
git apply --reject --ignore-whitespace --exclude=README.md changes.patch
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Step 2: Resolving issues
|
|
63
|
+
|
|
64
|
+
### Resolving package.json issues
|
|
65
|
+
|
|
66
|
+
If running the upgrade steps results in a `package.json.rej` file and the diff
|
|
67
|
+
is large, it can be easier to manually update the `package.json` file.
|
|
68
|
+
|
|
69
|
+
Compare your local /package.json with the example's
|
|
70
|
+
`/upgrade/examples/magento-graphcms/package.json` you just downloaded and:
|
|
71
|
+
|
|
72
|
+
1. Replace your local `dependencies` with the example's `dependencies`. Keep any
|
|
73
|
+
additional installed local dependencies and
|
|
74
|
+
[remove PSP's](./getting-started/create.md#remove-unused-psps) your backend
|
|
75
|
+
doesn't support.
|
|
76
|
+
2. Replace your local `devDependencies` with the example's `devDependencies`
|
|
77
|
+
3. Replace your local `scripts` with the example's `scripts_local`
|
|
78
|
+
|
|
79
|
+
After updating the package.json file, run the following to install the latest
|
|
80
|
+
packages:
|
|
81
|
+
|
|
82
|
+
- `rm yarn.lock && yarn` Remove lock and install the dependencies
|
|
83
|
+
- `yarn codegen` Converts all .graphql files to typescript files
|
|
84
|
+
- `yarn dev` Run the app
|
|
85
|
+
|
|
86
|
+
### Resolving diff issues
|
|
87
|
+
|
|
88
|
+
When you run `git apply ...` (step 4), git will try and apply all the diffs from
|
|
89
|
+
the patch file to your project files. When applying a diff fails, a
|
|
90
|
+
[reject ↗](https://git-scm.com/docs/git-apply#Documentation/git-apply.txt---reject)
|
|
91
|
+
`.rej` file will be created for _each_ file that could not be upgraded.
|
|
92
|
+
|
|
93
|
+
It can very well be that some files can't be updated automatically, because of
|
|
94
|
+
modifications you made. The CLI will show you the location of these files, as
|
|
95
|
+
well as the number of hunks:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Applying patch pages/_app.tsx with 2 rejects...
|
|
99
|
+
Rejected hunk #1.
|
|
100
|
+
Rejected hunk #2.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The suggested changes have to be reviewed _manually_ (a diff tool can provide
|
|
104
|
+
insight, but won't be able to apply diffs). Manually apply the suggested changes
|
|
105
|
+
you want. Discard the .rej files of the suggested changes you don't want. Before
|
|
106
|
+
you commit, make sure to delete all the .rej files:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
find . -type f -name '*.rej' -delete
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
After resolving the diff issues, run and validate your local environment:
|
|
113
|
+
|
|
114
|
+
- `yarn codegen` should run without errors
|
|
115
|
+
- `yarn tsc:lint` should run without errors
|
|
116
|
+
- `yarn dev` should run without errors
|
|
117
|
+
|
|
118
|
+
## Next steps
|
|
119
|
+
|
|
120
|
+
- Learn how to [contribute to GraphCommerce](./contributing.md)
|