You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the issue this PR is solving, why it's happening, and how to reproduce it. This may differ from the original ticket as you now have more information at your disposal.
7
8
8
9
## Solution
10
+
9
11
Summarize your solution to the problem. Please include short descriptions of any solutions you tested before arriving at your final solution. This will help reviewers know why you decided to solve this problem in this particular way and will speed up the review process.
10
12
11
13
If you're solving a UIX related issue, please attach screen-caps or gifs showing how your solution differs from the issue.
12
14
13
15
## Breaking changes
16
+
14
17
If you have a breaking changes, list them here, otherwise list none.
15
18
16
19
Examples of breaking changes include changing file names, moving files, deleting files, renaming functions or exports, or changes to code which might cause previous versions of Reaction or third-party code not to work as expected.
17
20
18
21
Note any work that you did to mitigate the effect of any breaking changes such as creating migrations, deprecation warnings, etc.
19
22
20
-
21
23
## Testing
24
+
22
25
1. List the steps needed for testing your change in this section.
23
26
2. Assume that testers already know how to start the app, and do the basic setup tasks.
24
27
3. Be detailed enough that someone can work through it without being too granular
25
28
26
-
More detail for what each of these sections should include are available in our [Contributing Docs](https://docs.reactioncommerce.com/reaction-docs/trunk/contributing-to-reaction)
29
+
More detail for what each of these sections should include are available in our [Contributing Docs](https://docs.reactioncommerce.com/reaction-docs/trunk/contributing-to-reaction). This project uses [semantic-release](https://semantic-release.gitbook.io/semantic-release/), please use their [commit message format.](https://semantic-release.gitbook.io/semantic-release/#commit-message-format).
Copy file name to clipboardExpand all lines: README.md
+44-15Lines changed: 44 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@
5
5
This Example Storefront is to serve as a reference on how to implement a web based storefront using the Reaction Commerce GraphQL API. You can fork this project as a jumping off point or create your own custom experience using your prefered client-side technology. While we believe our example storefront is full featured enough to use in production, it may be missing features your shop requires at this time.
6
6
7
7
## Features
8
+
8
9
Reaction comes with a robust set of core commerce capabilities right out of the box. And since anything in our codebase can be extended, overwritten, or installed as a package, you may also customize anything on our platform.
9
10
10
11
Check out the full list of Reaction [features](https://www.reactioncommerce.com/features) and [release history](https://reactioncommerce.com/roadmap) for more info.
@@ -25,7 +26,7 @@ This example storefront is built with [Next.js](https://nextjs.org/), [React](ht
25
26
Follow the [Reaction Platform docs](https://docs.reactioncommerce.com/docs/installation-reaction-platform) to install and run all the services necessary to run the storefront:
@@ -51,32 +52,37 @@ When running the storefront and Reaction for the first time, you will need to co
51
52
Read the docs for [setting up Segment or a custom analytics tracker](docs/tracking-events.md)
52
53
53
54
## Documentation
55
+
54
56
-[Example Storefront full documentation](./docs)
55
57
-[Example Storefront Component Library repository](https://github.com/reactioncommerce/reaction-component-library), [documentation](https://github.com/reactioncommerce/reaction-component-library/tree/master/docs), and [component documentation](http://designsystem.reactioncommerce.com/)
56
58
-[Reaction Docs: Using GraphQL](https://docs.reactioncommerce.com/docs/graphql-using)
57
59
-[Reaction Docs: Testing with Jest](https://docs.reactioncommerce.com/docs/testing-reaction)
58
-
-[Reaction Docs: Developing with Docker](https://docs.reactioncommerce.com/docs/installation-docker-development
59
-
)
60
+
-[Reaction Docs: Developing with Docker](https://docs.reactioncommerce.com/docs/installation-docker-development)
60
61
61
62
## Development
62
63
63
64
The Reaction Platform runs the storefront with Docker, so you will have to use Docker commands to view logs, run commands inside the container and more. To run commands specifically for the storefront, make sure to change directories into the `example-storefront` directory within the `reaction-platform` repository:
65
+
64
66
```sh
65
67
cd example-storefront
66
68
```
67
69
68
70
### Build and run in development mode with logs
71
+
69
72
Create a symbolic link to use the development Docker image:
If running for the first time or environment variables in `.env.example` have changed execute the command below to update environment variables.
79
+
75
80
```
76
81
./bin/setup
77
82
```
78
83
79
84
Start the storefront by executing:
85
+
80
86
```sh
81
87
docker-compose up -d && docker-compose logs -f
82
88
```
@@ -94,26 +100,31 @@ docker-compose run --rm --service-ports web yarn start
94
100
```sh
95
101
docker-compose run --rm web [command]
96
102
```
103
+
97
104
Run any command inside a Docker container and then remove the container. Use this to run any tooling operations. Remember your project directory will be mounted and things will usually just work. See Yarn section below for more examples.
98
105
99
106
### Run tests in container
100
107
101
108
Run tests locally
109
+
102
110
```sh
103
111
docker-compose run --rm web yarn test
104
112
```
105
113
106
114
Run tests locally without cache (this can be helpful if changes aren't showing up)
115
+
107
116
```sh
108
117
docker-compose run --rm web yarn test --no-cache
109
118
```
110
119
111
120
To run Snyk security tests (this will run tests in the same way as CI)
121
+
112
122
```sh
113
123
docker-compose run --rm web sh -c "cp package.json ../ && cp .snyk ../ && cd .. && snyk auth && snyk test"
114
124
```
115
125
116
126
To run ESLint
127
+
117
128
```sh
118
129
docker-compose run --rm web eslint src
119
130
```
@@ -129,13 +140,15 @@ You can use the Google Chrome DevTools to debug the code running in the Node.js
129
140
130
141
Yarn & NPM should run inside the Docker container. We've taken steps to ensure that the node_modules are placed into a cacheable location. If you run Yarn locally, the node_modules are written directly to the project directory and take precedence over those from the Docker build.
131
142
**Yarn Add**
143
+
132
144
```
133
145
docker-compose run --rm web yarn add --dev [package]
134
146
```
135
147
136
148
**Yarn Install**
137
149
138
150
⚠️ Always rebuild the image and start a new container after modifying yarn.lock or Dockerfile!
151
+
139
152
```
140
153
docker-compose run --rm web yarn install
141
154
docker-compose down --rmi local
@@ -155,25 +168,29 @@ Sometimes we need to test the [Example Storefront Component Library](https://git
155
168
1. Inside your `.env` file, change `INTERNAL_GRAPHQL_URL` to equal `http://localhost:3000/graphql`, the same as the `EXTERNAL_GRAPHQL_URL`
156
169
1. Start the storefront locally by running the command `export $(cat .env | xargs) && yarn dev`
157
170
1. Your storefront should now be running at `localhost:4000`
158
-
- If you see errors about not being able to find peer dependency packages, that seems to be an issues with yarn linking. You can just temporarily `yarn add` each of those packages in the component library `package/dist` folder. (This folder is gitignored anyway.)
171
+
- If you see errors about not being able to find peer dependency packages, that seems to be an issues with yarn linking. You can just temporarily `yarn add` each of those packages in the component library `package/dist` folder. (This folder is gitignored anyway.)
159
172
1. After your changes are tested, shut down the storefront by running the command `CTRL+C`
160
173
1. Run `yarn unlink "@reactioncommerce/components"` in the storefront repo folder
161
174
1.`cd` to the `package/dist` folder of the `reaction-component-library` repo. Run the command `yarn unlink` to unlink the local version of the component library
162
175
1. Undo the renaming of your `.yarnrc` file
163
176
1. Undo the URL change inside your `.env` file
164
177
165
178
## Clean up containers
179
+
166
180
Stop, and retain containers:
181
+
167
182
```sh
168
183
docker-compose stop
169
184
```
170
185
171
186
Stop, and remove containers:
187
+
172
188
```sh
173
189
docker-compose down
174
190
```
175
191
176
192
Stop, and remove containers, volumes and built images:
193
+
177
194
```sh
178
195
docker-compose down -v --rmi local
179
196
```
@@ -187,6 +204,7 @@ Run this command to build a Docker image with the production build of the app in
Find a bug, a typo, or something that’s not documented well? We’d love for you to [open an issue](https://github.com/reactioncommerce/example-storefront/issues) telling us what we can improve!
228
+
Find a bug, a typo, or something that’s not documented well? We’d love for you to [open an issue](https://github.com/reactioncommerce/example-storefront/issues) telling us what we can improve! This project uses [semantic-release](https://semantic-release.gitbook.io/semantic-release/), please use their [commit message format.](https://semantic-release.gitbook.io/semantic-release/#commit-message-format).
211
229
212
230
Want to request a feature? Use our [Reaction Feature Requests repository](https://github.com/reactioncommerce/reaction-feature-requests) to file a request.
213
231
214
232
We love your pull requests! Check our our [`Good First Issue`](https://github.com/reactioncommerce/example-storefront/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) and [`Help Wanted`](https://github.com/reactioncommerce/example-storefront/issues?q=label%3A%22help+wanted%22) tags for good issues to tackle.
215
233
216
234
### Pull Request guidelines
235
+
217
236
Pull requests should pass all automated tests, style, and security checks.
218
237
219
238
#### Automated Tests
239
+
220
240
Your code should pass all [acceptance tests and unit tests](https://docs.reactioncommerce.com/reaction-docs/trunk/testing-reaction). Run
241
+
221
242
```sh
222
243
docker-compose run --rm web yarn test
223
244
```
245
+
224
246
to run the test suites locally. If you're adding functionality to Reaction, you should add tests for the added functionality. You can run the tests locally without cache if necessary by passing the `--no-cache` flag. This can be helpful if changes aren't showing up.
247
+
225
248
```sh
226
249
docker-compose run --rm web yarn test --no-cache
227
250
```
228
251
229
252
To update a failing snapshot (if you've made changes to a component)
253
+
230
254
```sh
231
255
docker-compose run --rm web yarn test -u
232
256
```
233
257
234
258
#### Eslint
259
+
235
260
We require that all code contributed to Reaction follows [Reaction's ESLint rules](https://github.com/reactioncommerce/reaction-eslint-config). You can run
261
+
236
262
```
237
263
docker-compose run --rm web eslint src
238
264
```
265
+
239
266
to run ESLint against your code locally.
240
267
241
268
Please follow the [Reaction Code Style Guide](https://docs.reactioncommerce.com/docs/styleguide). Check out our guides to [JSDoc](https://docs.reactioncommerce.com/docs/jsdoc-style-guide), [Git](https://docs.reactioncommerce.com/docs/git-style-guide), [error handling](https://docs.reactioncommerce.com/docs/error-handling-guide), [logging](https://docs.reactioncommerce.com/docs/logging), and [React](https://docs.reactioncommerce.com/docs/react-best-practices).
@@ -245,7 +272,9 @@ We also request that you follow the our [pull request template](https://docs.rea
245
272
Get more details in our [Contributing Guide](https://docs.reactioncommerce.com/docs/contributing-to-reaction).
246
273
247
274
### Developer Certificate of Origin
275
+
248
276
We use the [Developer Certificate of Origin (DCO)](https://developercertificate.org/) in lieu of a Contributor License Agreement for all contributions to Reaction Commerce open source projects. We request that contributors agree to the terms of the DCO and indicate that agreement by signing all commits made to Reaction Commerce projects by adding a line with your name and email address to every Git commit message contributed:
0 commit comments