@graphcommerce/docs 4.5.0 → 4.5.3
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 +18 -0
- package/framework/deployment.md +4 -0
- package/framework/environment-variables.md +4 -0
- package/framework/graphcms.md +4 -0
- package/framework/icons.md +5 -1
- package/framework/readme.md +4 -0
- package/framework/static-generation.md +4 -0
- package/framework/translations.md +182 -4
- package/framework/troubleshooting.md +4 -0
- package/getting-started/create.md +16 -9
- package/getting-started/graphcms-component.md +5 -1
- package/getting-started/header.md +4 -0
- package/getting-started/pages.md +4 -0
- package/getting-started/readme.md +4 -0
- package/getting-started/start-building.md +4 -0
- package/package.json +2 -2
- package/readme.md +4 -0
- package/roadmap.md +5 -7
- package/upgrading.md +58 -106
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.5.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1373](https://github.com/graphcommerce-org/graphcommerce/pull/1373) [`48cb78229`](https://github.com/graphcommerce-org/graphcommerce/commit/48cb782299a9efecffbe338e2954af03293e27c8) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Update docs, translations
|
|
8
|
+
|
|
9
|
+
## 4.5.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#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
|
|
14
|
+
|
|
15
|
+
## 4.5.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#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
|
|
20
|
+
|
|
3
21
|
## 4.5.0
|
|
4
22
|
|
|
5
23
|
### Minor 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
|
|
@@ -72,7 +76,7 @@ In /components/Layout/LayoutFull.tsx:
|
|
|
72
76
|
|
|
73
77
|
```tsx
|
|
74
78
|
...
|
|
75
|
-
import iconCustomerService from '@graphcommerce/next-ui'
|
|
79
|
+
import { iconCustomerService } from '@graphcommerce/next-ui'
|
|
76
80
|
|
|
77
81
|
...
|
|
78
82
|
return (
|
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
|
|
@@ -71,15 +71,30 @@ Add Linqui to the component's imports:
|
|
|
71
71
|
import { t, Trans } from '@lingui/macro'
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
Run `yarn lingui`. All new (missing) translations will be added to translations
|
|
75
|
+
files:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
//Example terminal output
|
|
79
|
+
|
|
80
|
+
┌─────────────┬─────────────┬─────────┐
|
|
81
|
+
│ Language │ Total count │ Missing │
|
|
82
|
+
├─────────────┼─────────────┼─────────┤
|
|
83
|
+
│ en (source) │ 208 │ - │
|
|
84
|
+
│ nl │ 208 │ 1 │
|
|
85
|
+
│ es │ 208 │ 1 │
|
|
86
|
+
└─────────────┴─────────────┴─────────┘
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Edit the translations files to add your translation:
|
|
75
90
|
|
|
76
91
|
```ts
|
|
77
|
-
Example
|
|
92
|
+
//Example from /locales/es.po
|
|
78
93
|
|
|
79
94
|
...
|
|
80
95
|
|
|
81
96
|
msgid "Call us now"
|
|
82
|
-
msgstr "
|
|
97
|
+
msgstr ""
|
|
83
98
|
```
|
|
84
99
|
|
|
85
100
|
## Passing `{values}` to translations
|
|
@@ -96,7 +111,7 @@ You can pass values in msgid's:
|
|
|
96
111
|
The syntax in the translation files:
|
|
97
112
|
|
|
98
113
|
```ts
|
|
99
|
-
Example
|
|
114
|
+
//Example from /locales/en.po
|
|
100
115
|
|
|
101
116
|
...
|
|
102
117
|
|
|
@@ -107,6 +122,169 @@ msgid "Cart ({0})"
|
|
|
107
122
|
msgstr "Cart ({0})"
|
|
108
123
|
```
|
|
109
124
|
|
|
125
|
+
## Adding a new language
|
|
126
|
+
|
|
127
|
+
1. Create a new storeview and configure the locale,
|
|
128
|
+
`Admin > Store > Configuration > General > General > Locale`. Choose one of
|
|
129
|
+
the options from the Magento Locale codes (below).
|
|
130
|
+
2. In your .env file, add the desired route and store_code to the
|
|
131
|
+
`NEXT_PUBLIC_LOCALE_STORES` environment variable. The route will be visible
|
|
132
|
+
to the user (added to the url) when the user switches storeview.
|
|
133
|
+
|
|
134
|
+
It's considered best practice to match the route with the locale code,
|
|
135
|
+
replacing an underscore for a dash. For example, to add Swedish (Finland),
|
|
136
|
+
which has locale code sv_FI, add the following:
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
//Example from .env
|
|
140
|
+
|
|
141
|
+
NEXT_PUBLIC_LOCALE_STORES =
|
|
142
|
+
'{"en-us":"default",sv-fi":"[store_code from desired storeview]"}'
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
3. Run `yarn lingui`:
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
//Example terminal output
|
|
149
|
+
|
|
150
|
+
┌─────────────┬─────────────┬─────────┐
|
|
151
|
+
│ Language │ Total count │ Missing │
|
|
152
|
+
├─────────────┼─────────────┼─────────┤
|
|
153
|
+
│ en (source) │ 208 │ - │
|
|
154
|
+
│ sv │ 208 │ 208 │
|
|
155
|
+
└─────────────┴─────────────┴─────────┘
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
4. A new .po translation file will be generated in the /locales directory, the
|
|
159
|
+
filename matching the object key or, in case a locale code is used, matching
|
|
160
|
+
the charactes before the dash (which represent the language).
|
|
161
|
+
|
|
162
|
+
In the example above, the filename would result in `sv.po`:
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
//Example from /locales/sv.po
|
|
166
|
+
|
|
167
|
+
msgid ""
|
|
168
|
+
msgstr ""
|
|
169
|
+
"POT-Creation-Date: 2022-03-30 14:45+0200\n"
|
|
170
|
+
"MIME-Version: 1.0\n"
|
|
171
|
+
"Content-Type: text/plain; charset=utf-8\n"
|
|
172
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
173
|
+
"X-Generator: @lingui/cli\n"
|
|
174
|
+
"Language: sv\n"
|
|
175
|
+
|
|
176
|
+
msgid "<0>{name}</0> has been added to your shopping cart!"
|
|
177
|
+
msgstr ""
|
|
178
|
+
|
|
179
|
+
msgid "Above <0/>"
|
|
180
|
+
msgstr ""
|
|
181
|
+
|
|
182
|
+
msgid "Account"
|
|
183
|
+
msgstr ""
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
5. Add your translations ins the newly created .po file. Run the app and use the
|
|
188
|
+
store switcher to navigate to your new storeview.
|
|
189
|
+
[Github copilot ↗](https://copilot.github.com/) provides very accurate
|
|
190
|
+
suggestions in VS Code with the
|
|
191
|
+
[Github copilot extention ↗](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot).
|
|
192
|
+
|
|
193
|
+
### Magento Locale codes
|
|
194
|
+
|
|
195
|
+
| Locale | Language (country) |
|
|
196
|
+
| ---------- | --------------------------------------------------- |
|
|
197
|
+
| af_ZA | Afrikaans (South Africa) |
|
|
198
|
+
| sq_AL | Albanian (Albania) |
|
|
199
|
+
| ar_DZ | Arabic (Algeria) |
|
|
200
|
+
| ar_EG | Arabic (Egypt) |
|
|
201
|
+
| ar_KW | Arabic (Kuwait) |
|
|
202
|
+
| ar_MA | Arabic (Morocco) |
|
|
203
|
+
| ar_SA | Arabic (Saudi Arabia) |
|
|
204
|
+
| az_Latn_AZ | Azerbaijani (Latijns, Azerbaijan) |
|
|
205
|
+
| bn_BD | Bangla (Bangladesh) |
|
|
206
|
+
| eu_ES | Basque (Spain) |
|
|
207
|
+
| be_BY | Belarusian (Belarus) |
|
|
208
|
+
| bs_Latn_BA | Bosnian (Latijns, Bosnia & Herzegovina) |
|
|
209
|
+
| bg_BG | Bulgarian (Bulgaria) |
|
|
210
|
+
| ca_ES | Catalan (Spain) |
|
|
211
|
+
| zh_Hant_HK | Chinese (traditioneel Chinees, Hong Kong SAR China) |
|
|
212
|
+
| zh_Hant_TW | Chinese (traditioneel Chinees, Taiwan) |
|
|
213
|
+
| zh_Hans_CN | Chinese (vereenvoudigd Chinees, China) |
|
|
214
|
+
| hr_HR | Croatian (Croatia) |
|
|
215
|
+
| cs_CZ | Czech (Czechia) |
|
|
216
|
+
| da_DK | Danish (Denmark) |
|
|
217
|
+
| nl_BE | Dutch (Belgium) |
|
|
218
|
+
| nl_NL | Dutch (Netherlands) |
|
|
219
|
+
| en_AU | English (Australia) |
|
|
220
|
+
| en_CA | English (Canada) |
|
|
221
|
+
| en_IE | English (Ireland) |
|
|
222
|
+
| en_NZ | English (New Zealand) |
|
|
223
|
+
| en_GB | English (United Kingdom) |
|
|
224
|
+
| en_US | English (United States) |
|
|
225
|
+
| et_EE | Estonian (Estonia) |
|
|
226
|
+
| fil_PH | Filipino (Philippines) |
|
|
227
|
+
| fi_FI | Finnish (Finland) |
|
|
228
|
+
| fr_BE | French (Belgium) |
|
|
229
|
+
| fr_CA | French (Canada) |
|
|
230
|
+
| fr_FR | French (France) |
|
|
231
|
+
| fr_LU | French (Luxembourg) |
|
|
232
|
+
| fr_CH | French (Switzerland) |
|
|
233
|
+
| gl_ES | Galician (Spain) |
|
|
234
|
+
| ka_GE | Georgian (Georgia) |
|
|
235
|
+
| de_AT | German (Austria) |
|
|
236
|
+
| de_DE | German (Germany) |
|
|
237
|
+
| de_LU | German (Luxembourg) |
|
|
238
|
+
| de_CH | German (Switzerland) |
|
|
239
|
+
| el_GR | Greek (Greece) |
|
|
240
|
+
| gu_IN | Gujarati (India) |
|
|
241
|
+
| he_IL | Hebrew (Israel) |
|
|
242
|
+
| hi_IN | Hindi (India) |
|
|
243
|
+
| hu_HU | Hungarian (Hungary) |
|
|
244
|
+
| is_IS | Icelandic (Iceland) |
|
|
245
|
+
| id_ID | Indonesian (Indonesia) |
|
|
246
|
+
| it_IT | Italian (Italy) |
|
|
247
|
+
| it_CH | Italian (Switzerland) |
|
|
248
|
+
| ja_JP | Japanese (Japan) |
|
|
249
|
+
| km_KH | Khmer (Cambodia) |
|
|
250
|
+
| ko_KR | Korean (South Korea) |
|
|
251
|
+
| lo_LA | Lao (Laos) |
|
|
252
|
+
| lv_LV | Latvian (Latvia) |
|
|
253
|
+
| lt_LT | Lithuanian (Lithuania) |
|
|
254
|
+
| mk_MK | Macedonian (North Macedonia) |
|
|
255
|
+
| ms_MY | Malay (Malaysia) |
|
|
256
|
+
| nb_NO | Norwegian Bokmål (Norway) |
|
|
257
|
+
| nn_NO | Norwegian Nynorsk (Norway) |
|
|
258
|
+
| fa_IR | Persian (Iran) |
|
|
259
|
+
| pl_PL | Polish (Poland) |
|
|
260
|
+
| pt_BR | Portuguese (Brazil) |
|
|
261
|
+
| pt_PT | Portuguese (Portugal) |
|
|
262
|
+
| ro_RO | Romanian (Romania) |
|
|
263
|
+
| ru_RU | Russian (Russia) |
|
|
264
|
+
| sr_Cyrl_RS | Serbian (Cyrillisch, Serbia) |
|
|
265
|
+
| sr_Latn_RS | Serbian (Latijns, Serbia) |
|
|
266
|
+
| sk_SK | Slovak (Slovakia) |
|
|
267
|
+
| sl_SI | Slovenian (Slovenia) |
|
|
268
|
+
| es_AR | Spanish (Argentina) |
|
|
269
|
+
| es_BO | Spanish (Bolivia) |
|
|
270
|
+
| es_CL | Spanish (Chile) |
|
|
271
|
+
| es_CO | Spanish (Colombia) |
|
|
272
|
+
| es_CR | Spanish (Costa Rica) |
|
|
273
|
+
| es_MX | Spanish (Mexico) |
|
|
274
|
+
| es_PA | Spanish (Panama) |
|
|
275
|
+
| es_PE | Spanish (Peru) |
|
|
276
|
+
| es_ES | Spanish (Spain) |
|
|
277
|
+
| es_US | Spanish (United States) |
|
|
278
|
+
| es_VE | Spanish (Venezuela) |
|
|
279
|
+
| sw_KE | Swahili (Kenya) |
|
|
280
|
+
| sv_FI | Swedish (Finland) |
|
|
281
|
+
| sv_SE | Swedish (Sweden) |
|
|
282
|
+
| th_TH | Thai (Thailand) |
|
|
283
|
+
| tr_TR | Turkish (Turkey) |
|
|
284
|
+
| uk_UA | Ukrainian (Ukraine) |
|
|
285
|
+
| vi_VN | Vietnamese (Vietnam) |
|
|
286
|
+
| cy_GB | Welsh (United Kingdom) |
|
|
287
|
+
|
|
110
288
|
## Next steps
|
|
111
289
|
|
|
112
290
|
- Learn more about
|
|
@@ -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
|
|
@@ -71,7 +71,7 @@ https://user-images.githubusercontent.com/1251986/158647122-dc57002f-a9c2-4661-a
|
|
|
71
71
|
4. `cd my-project`
|
|
72
72
|
5. `cp -R .env.example .env`
|
|
73
73
|
6. `rm CHANGELOG.md`
|
|
74
|
-
7. `rm -
|
|
74
|
+
7. `rm -r node_modules && rm -r .next`
|
|
75
75
|
|
|
76
76
|
Edit /package.json. Delete `"scripts": {...}` and rename `scripts_local` to
|
|
77
77
|
`scripts`:
|
|
@@ -110,22 +110,29 @@ project, you need to update variables in the /.env file. The .env file contains
|
|
|
110
110
|
useful information about your storefront.
|
|
111
111
|
|
|
112
112
|
`MAGENTO_ENDPOINT=""`
|
|
113
|
-
Magento 2 API
|
|
113
|
+
Magento 2 API URL, located at `http://<magento2-server>/graphql`.
|
|
114
114
|
|
|
115
115
|
`IMAGE_DOMAINS=",media.graphcms.com"`
|
|
116
116
|
Comma-separated list of image domains. Add media.graphcms.com as default.
|
|
117
117
|
|
|
118
118
|
`GRAPHCMS_URL=""`
|
|
119
|
-
GraphCMS API
|
|
119
|
+
GraphCMS API URL. Once logged in, copy it from Project Settings > Api Access >
|
|
120
120
|
Content API
|
|
121
121
|
|
|
122
|
-
`NEXT_PUBLIC_LOCALE_STORES='{"en": "
|
|
123
|
-
List of routes and store_codes
|
|
124
|
-
would result in the storeview 'default' is loaded. GraphCommerce uses the
|
|
125
|
-
browser language to determine which storeview to load. A URL suffix will be
|
|
126
|
-
added as a result, with the exception of the first option in the list.
|
|
122
|
+
`NEXT_PUBLIC_LOCALE_STORES='{"en-us": "default", "en-ca": "canada"}'`
|
|
123
|
+
List of routes and store_codes:
|
|
127
124
|
|
|
128
|
-
|
|
125
|
+
- When the user switches to the Canadian storeview, the suffix /en-ca is added
|
|
126
|
+
to the URL.
|
|
127
|
+
- The first storeview in the object is loaded by default. No suffix is added to
|
|
128
|
+
the URL.
|
|
129
|
+
- The key (en-ca) is used to load the storeview
|
|
130
|
+
[translation](../framework/translations.md)
|
|
131
|
+
- When a users' browser language matches a storeviews' locale
|
|
132
|
+
(`Admin > Store > Configuration > General > General > Locale`), the user is
|
|
133
|
+
automatically redirected to the corresponding storeview.
|
|
134
|
+
|
|
135
|
+
> If you need to fetch a list of available store_codes, run `yarn dev` when you
|
|
129
136
|
> entered your `MAGENTO_ENDPOINT`. The app won't build, but the GraphQL explorer
|
|
130
137
|
> will start at `http://localhost:3000/api/graphql`. Enter the following query:
|
|
131
138
|
>
|
|
@@ -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
|
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
|
|
@@ -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).
|
package/package.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
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.
|
|
5
|
+
"version": "4.5.3",
|
|
6
6
|
"sideEffects": true,
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@graphcommerce/prettier-config-pwa": "^4.0.
|
|
8
|
+
"@graphcommerce/prettier-config-pwa": "^4.0.5"
|
|
9
9
|
},
|
|
10
10
|
"prettier": "@graphcommerce/prettier-config-pwa"
|
|
11
11
|
}
|
package/readme.md
CHANGED
|
@@ -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
|
package/roadmap.md
CHANGED
|
@@ -9,16 +9,14 @@ The following overview contains the status of items on the GraphCommerce roadmap
|
|
|
9
9
|
|
|
10
10
|
## In progress
|
|
11
11
|
|
|
12
|
-
- [
|
|
13
|
-
|
|
14
|
-
- [
|
|
15
|
-
- [ ] Quality improvements (Reduce components, naming)
|
|
12
|
+
- [ ] Adyen payment service (Braintree, Mollie, Klarna, Paypal already
|
|
13
|
+
implemented)
|
|
14
|
+
- [ ] Wishlist
|
|
16
15
|
|
|
17
16
|
## Planned
|
|
18
17
|
|
|
19
|
-
- [ ]
|
|
20
|
-
- [ ]
|
|
21
|
-
- [ ] Payment service provider integration
|
|
18
|
+
- [ ] Buckaroo payment service
|
|
19
|
+
- [ ] Multisafepay payment service
|
|
22
20
|
|
|
23
21
|
## Future
|
|
24
22
|
|
package/upgrading.md
CHANGED
|
@@ -1,37 +1,31 @@
|
|
|
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
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
We are going to upgrade your project to the latest version, for all the new
|
|
9
|
-
features and fixes that we've made. We can automate most of this process, but
|
|
10
|
-
there are some manual steps involved.
|
|
11
|
-
|
|
12
|
-
We try to keep changes to the examples minimal as possible, but sometimes this
|
|
13
|
-
is inevitable. 95% of the changes are made inside the @graphcommerce packages,
|
|
14
|
-
but for some changes we need to make changes in the example to get everything
|
|
15
|
-
working.
|
|
8
|
+
</div>
|
|
16
9
|
|
|
17
|
-
|
|
10
|
+
# Upgrading
|
|
18
11
|
|
|
19
|
-
|
|
12
|
+
This guide describes how to upgrade your GraphCommerce project files and its
|
|
13
|
+
dependencies, while keeping your customizations.
|
|
20
14
|
|
|
21
|
-
After you've finished this guide, you'll have accomplished the following:
|
|
15
|
+
### After you've finished this upgrading guide, you'll have accomplished the following:
|
|
22
16
|
|
|
23
17
|
- Created a changes.patch file and applied it to your project
|
|
24
18
|
- Upgraded all dependencies to the latest version
|
|
25
|
-
- Incorporated all latest changes in your project while
|
|
19
|
+
- Incorporated all the latest changes in your project, while keeping your
|
|
26
20
|
customizations
|
|
27
21
|
|
|
28
|
-
##
|
|
29
|
-
|
|
30
|
-
1. Get the version of **your own project**
|
|
22
|
+
## Step 1: Creating and applying a patch file
|
|
31
23
|
|
|
32
|
-
|
|
24
|
+
1. In package.json, find your version:
|
|
33
25
|
|
|
34
26
|
```json
|
|
27
|
+
// Example from package.json
|
|
28
|
+
|
|
35
29
|
{
|
|
36
30
|
"dependencies": {
|
|
37
31
|
//...
|
|
@@ -41,128 +35,86 @@ After you've finished this guide, you'll have accomplished the following:
|
|
|
41
35
|
}
|
|
42
36
|
```
|
|
43
37
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
2. Create a clone of the `https://github.com/graphcommerce-org/graphcommerce`
|
|
47
|
-
repo.
|
|
38
|
+
2. Download a fresh copy of the repository:
|
|
48
39
|
|
|
49
40
|
```bash
|
|
50
|
-
git clone git@github.com:graphcommerce-org/graphcommerce.git
|
|
41
|
+
git clone git@github.com:graphcommerce-org/graphcommerce.git upgrade
|
|
51
42
|
```
|
|
52
43
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
3. Create a patch from the example
|
|
57
|
-
|
|
58
|
-
Replace `OLD_VERSION` in the command below with the version number of
|
|
59
|
-
`@graphcommerce/next-ui` you just looked up:
|
|
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`:
|
|
60
47
|
|
|
61
48
|
```bash
|
|
62
49
|
git diff --relative=examples/magento-graphcms "@graphcommerce/next-ui@OLD_VERSION" examples/magento-graphcms ':!examples/magento-graphcms/CHANGELOG.md' > changes.patch
|
|
63
50
|
```
|
|
64
51
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
the `graphcommerce` repo.
|
|
68
|
-
|
|
69
|
-
4. Move the file to your project's root directory
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
mv changes.patch ../your-project-root
|
|
73
|
-
cd ../your-project-root
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Tip: create a separate branch
|
|
52
|
+
4. Move the `changes.patch` file from the /upgrade directory to the root of your
|
|
53
|
+
project.
|
|
77
54
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
You should now have a changes.patch file in the root of your project.
|
|
83
|
-
|
|
84
|
-
5. Apply the patch to your project
|
|
85
|
-
|
|
86
|
-
Make sure your working directory is clean (except for the changes.patch file)
|
|
87
|
-
and run:
|
|
55
|
+
5. Apply the patch to your project (It's recommended to apply changes on a new
|
|
56
|
+
branch):
|
|
88
57
|
|
|
89
58
|
```bash
|
|
90
59
|
git apply --reject --ignore-whitespace --exclude=README.md changes.patch
|
|
91
60
|
```
|
|
92
61
|
|
|
93
|
-
|
|
62
|
+
## Step 2: Resolving issues
|
|
94
63
|
|
|
95
|
-
|
|
64
|
+
### Resolving package.json issues
|
|
96
65
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
rm changes.patch
|
|
100
|
-
```
|
|
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.
|
|
101
68
|
|
|
102
|
-
|
|
69
|
+
Compare your local /package.json with the example's
|
|
70
|
+
`/upgrade/examples/magento-graphcms/package.json` you just downloaded and:
|
|
103
71
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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`
|
|
110
78
|
|
|
111
|
-
|
|
79
|
+
After updating the package.json file, run the following to install the latest
|
|
80
|
+
packages:
|
|
112
81
|
|
|
113
|
-
|
|
114
|
-
|
|
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
|
|
115
85
|
|
|
116
|
-
|
|
117
|
-
`graphcommerce/examples/magento-example/package.json`.
|
|
86
|
+
### Resolving diff issues
|
|
118
87
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
- Replace your local `scripts` with the example `scripts_local`
|
|
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.
|
|
124
92
|
|
|
125
|
-
It
|
|
126
|
-
|
|
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:
|
|
127
96
|
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
rm package.json.rej
|
|
97
|
+
```
|
|
98
|
+
Applying patch pages/_app.tsx with 2 rejects...
|
|
99
|
+
Rejected hunk #1.
|
|
100
|
+
Rejected hunk #2.
|
|
133
101
|
```
|
|
134
102
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
above command will create rejection files like `Component.ts.rej` for each hunk
|
|
140
|
-
it couldn't apply.
|
|
141
|
-
|
|
142
|
-
All the '.rej' files **must** be handled manually by:
|
|
143
|
-
|
|
144
|
-
- Manually applying the diff in the .rej file to the original file because you
|
|
145
|
-
want the changes. (recommended)
|
|
146
|
-
- Discarding the .rej file because you've modified the project already.
|
|
147
|
-
|
|
148
|
-
Make sure all .rej files are deleted (`find . -type f -name '*.rej' -delete`)
|
|
149
|
-
|
|
150
|
-
Tip: make a commit
|
|
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:
|
|
151
107
|
|
|
152
108
|
```bash
|
|
153
|
-
|
|
109
|
+
find . -type f -name '*.rej' -delete
|
|
154
110
|
```
|
|
155
111
|
|
|
156
|
-
|
|
112
|
+
After resolving the diff issues, run and validate your local environment:
|
|
157
113
|
|
|
158
114
|
- `yarn codegen` should run without errors
|
|
159
115
|
- `yarn tsc:lint` should run without errors
|
|
160
116
|
- `yarn dev` should run without errors
|
|
161
117
|
|
|
162
|
-
|
|
163
|
-
project. Validate if everything looks right, especially the parts that have
|
|
164
|
-
manual changes.
|
|
165
|
-
|
|
166
|
-
You are done with the upgrade! 🎉
|
|
118
|
+
## Next steps
|
|
167
119
|
|
|
168
|
-
|
|
120
|
+
- Learn how to [contribute to GraphCommerce](./contributing.md)
|