@graphcommerce/docs 4.5.0 → 4.5.1

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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
8
+
3
9
  ## 4.5.0
4
10
 
5
11
  ### Minor Changes
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.0",
5
+ "version": "4.5.1",
6
6
  "sideEffects": true,
7
7
  "devDependencies": {
8
8
  "@graphcommerce/prettier-config-pwa": "^4.0.2"
package/upgrading.md CHANGED
@@ -1,168 +1,116 @@
1
1
  > **Developer preview**
2
2
  > This is a developer preview of GraphCommerce. The documentation will be
3
3
  > updated as GraphCommerce introduces
4
- > [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases).
4
+ > [new features and refines existing functionality](https://github.com/graphcommerce-org/graphcommerce/releases)
5
5
 
6
6
  # Upgrading
7
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.
8
+ This guide describes how to upgrade your GraphCommerce project files and its
9
+ dependencies, while keeping your customizations.
11
10
 
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.
16
-
17
- To upgrade your project to the latest version we need to do a few steps:
18
-
19
- ## What you'll do
20
-
21
- After you've finished this guide, you'll have accomplished the following:
11
+ ### After you've finished this upgrading guide, you'll have accomplished the following:
22
12
 
23
13
  - Created a changes.patch file and applied it to your project
24
14
  - Upgraded all dependencies to the latest version
25
- - Incorporated all latest changes in your project while maintaining all your
15
+ - Incorporated all the latest changes in your project, while keeping your
26
16
  customizations
27
17
 
28
- ## Create an apply a patch file
18
+ ## Step 1: Creating and applying a patch file
29
19
 
30
- 1. Get the version of **your own project**
20
+ 1. In package.json, find your version:
31
21
 
32
- In your local package.json you'll find something like this:
22
+ ```json
23
+ // Example from package.json
33
24
 
34
- ```json
35
- {
36
- "dependencies": {
37
- //...
38
- "@graphcommerce/next-ui": "^4.2.0"
39
- //...
40
- }
41
- }
42
- ```
43
-
44
- We need the version of `@graphcommerce/next-ui` later.
25
+ {
26
+ "dependencies": {
27
+ //...
28
+ "@graphcommerce/next-ui": "^4.2.0"
29
+ //...
30
+ }
31
+ }
32
+ ```
45
33
 
46
- 2. Create a clone of the `https://github.com/graphcommerce-org/graphcommerce`
47
- repo.
34
+ 2. Download a fresh copy of the repository:
48
35
 
49
36
  ```bash
50
- git clone git@github.com:graphcommerce-org/graphcommerce.git
37
+ git clone git@github.com:graphcommerce-org/graphcommerce.git upgrade
51
38
  ```
52
39
 
53
- Or if you have a local copy already available, make sure that you are on the
54
- latest commit of the `main` branch.
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:
40
+ 3. Navigate to the /upgrade directory you've just created. Run the following
41
+ command, but replace `OLD_VERSION` with your version of
42
+ `@graphcommerce/next-ui`:
60
43
 
61
44
  ```bash
62
45
  git diff --relative=examples/magento-graphcms "@graphcommerce/next-ui@OLD_VERSION" examples/magento-graphcms ':!examples/magento-graphcms/CHANGELOG.md' > changes.patch
63
46
  ```
64
47
 
65
- Run the above command (with OLD_VERSION replaced with something like `1.2.3`)
66
- in the `graphcommerce` repo. you should have a changes.patch file in root of
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
77
-
78
- ```bash
79
- git checkout -b my-upgrade
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
48
+ 4. Move the `changes.patch` file from the /upgrade directory to the root of your
49
+ project.
85
50
 
86
- Make sure your working directory is clean (except for the changes.patch file)
87
- and run:
51
+ 5. Apply the patch to your project (It's recommended to apply changes on a new
52
+ branch):
88
53
 
89
54
  ```bash
90
55
  git apply --reject --ignore-whitespace --exclude=README.md changes.patch
91
56
  ```
92
57
 
93
- You should now have all the changes from the example applied to your project.
58
+ ## Step 2: Resolving issues
94
59
 
95
- Tip: create an intermediate commit
60
+ ### Resolving package.json issues
96
61
 
97
- ```bash
98
- git commit -am"refactor: applied patches"
99
- rm changes.patch
100
- ```
62
+ If running the upgrade steps results in a `package.json.rej` file and the diff
63
+ is large, it can be easier to manually update the `package.json` file.
101
64
 
102
- ## What has happened?
65
+ Compare your local /package.json with the example's
66
+ `/upgrade/examples/magento-graphcms/package.json` you just downloaded and:
103
67
 
104
- > `git apply --reject` will try and apply all the diffs to your project and if
105
- > it isn't able to do so, it will create a `.rej` file for _each_ file that it
106
- > couldn't apply the changes to.
107
- >
108
- > `git` expects you to manually apply the changes in the `.rej` files to your
109
- > project.
68
+ 1. Replace your local `dependencies` with the example's `dependencies`. Keep any
69
+ additional installed local dependencies and
70
+ [remove PSP's](./getting-started/create.md#remove-unused-psps) your backend
71
+ doesn't support.
72
+ 2. Replace your local `devDependencies` with the example's `devDependencies`
73
+ 3. Replace your local `scripts` with the example's `scripts_local`
110
74
 
111
- ## Resolving package.json issues
75
+ After updating the package.json file, run the following to install the latest
76
+ packages:
112
77
 
113
- If you've got a package.json.rej file and the diff is very large, it might be
114
- easier to manually update the file.
78
+ - `rm yarn.lock && yarn` Remove lock and install the dependencies
79
+ - `yarn codegen` Converts all .graphql files to typescript files
80
+ - `yarn dev` Run the app
115
81
 
116
- We want to have the latest `dependencies`, `devDependencies` and `scripts` from
117
- `graphcommerce/examples/magento-example/package.json`.
82
+ ### Resolving diff issues
118
83
 
119
- - Replace your local `dependencies` with the example `dependencies` (and
120
- [remove PSPs](./getting-started/create.md#remove-unused-psps) your backend
121
- doesn't support)
122
- - Replace your local `devDependencies` with the example `devDependencies`
123
- - Replace your local `scripts` with the example `scripts_local`
84
+ When you run `git apply ...` (step 4), git will try and apply all the diffs from
85
+ the patch file to your project files. When applying a diff fails, a
86
+ [reject ↗](https://git-scm.com/docs/git-apply#Documentation/git-apply.txt---reject)
87
+ `.rej` file will be created for _each_ file that could not be upgraded.
124
88
 
125
- It might be that you have installed additional local dependencies, you can keep
126
- those.
89
+ It can very well be that some files can't be updated automatically, because of
90
+ modifications you made. The CLI will show you the location of these files, as
91
+ well as the number of hunks:
127
92
 
128
- ```bash
129
- rm yarn.lock
130
- yarn
131
- yarn codegen
132
- rm package.json.rej
93
+ ```
94
+ Applying patch pages/_app.tsx with 2 rejects...
95
+ Rejected hunk #1.
96
+ Rejected hunk #2.
133
97
  ```
134
98
 
135
- ## Resolving patch conflicts
136
-
137
- It can very wel be that some files can't be updated automatically, because of
138
- your modifications. You'll see something like `Rejected hunk #2` in the cli. The
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
99
+ The suggested changes have to be reviewed _manually_ (a diff tool can provide
100
+ insight, but won't be able to apply diffs). Manually apply the suggested changes
101
+ you want. Discard the .rej files of the suggested changes you don't want. Before
102
+ you commit, make sure to delete all the .rej files:
151
103
 
152
104
  ```bash
153
- git commit -am"refactor: processed manual .rej files"
105
+ find . -type f -name '*.rej' -delete
154
106
  ```
155
107
 
156
- ## Running and validating your project
108
+ After resolving the diff issues, run and validate your local environment:
157
109
 
158
110
  - `yarn codegen` should run without errors
159
111
  - `yarn tsc:lint` should run without errors
160
112
  - `yarn dev` should run without errors
161
113
 
162
- If the above commands are working correctly you should now have a working
163
- project. Validate if everything looks right, especially the parts that have
164
- manual changes.
165
-
166
- You are done with the upgrade! 🎉
114
+ ## Next steps
167
115
 
168
- Commit, push and deploy!
116
+ - Learn how to [contribute to GraphCommerce](./contributing.md)