Expand README's installation section

This commit is contained in:
tniezg 2021-08-20 14:18:14 +02:00
parent 4a007cab93
commit f16b6b8188

View File

@ -1,4 +1,4 @@
# [Spree Commerce][1] Provider # [Spree Commerce][1] Framework
A preview integration of Spree Commerce within NextJS Commerce. It supports browsing and searching Spree products and adding products to the cart as a guest user. A preview integration of Spree Commerce within NextJS Commerce. It supports browsing and searching Spree products and adding products to the cart as a guest user.
@ -8,7 +8,7 @@ Start by following the [instructions for setting up NextJS Commerce][2].
Next, setup Spree. The easiest way to run Spree locally is to follow the installation tutorial available at [the Spree Starter GitHub repository][3]. Next, setup Spree. The easiest way to run Spree locally is to follow the installation tutorial available at [the Spree Starter GitHub repository][3].
You may have to adjust Spree Starter to allow `localhost` and [CORS][4] requests. Run `docker-compose run web bundle add rack-cors` and: You have to adjust Spree Starter to allow `localhost` and [CORS][4] requests. Run `docker-compose run web bundle add rack-cors` and:
```ruby ```ruby
# In config/application.rb add a configuration for CORS: # In config/application.rb add a configuration for CORS:
@ -43,6 +43,12 @@ By default, Spree Starter and NextJS Commerce both run on port `3000`. Avoid col
} }
``` ```
Third, supply NextJS Commerce with custom environment variables required by the Spree Framework. Create a `.env.local` file in the root of NJC with contents based on `framework/spree/.env.template`.
`NEXT_PUBLIC_SPREE_CATEGORIES_TAXONOMY_ID` and `NEXT_PUBLIC_SPREE_BRANDS_TAXONOMY_ID` rely on IDs generated by Spree. Go to the Spree admin panel and create Categories and Brands taxonomies if they don't exist and copy their IDs into `.env.local`. The values of the other environment variables can be copied from `framework/spree/.env.template` as is.
Lastly, run `yarn dev` :tada:
[1]: https://spreecommerce.org/ [1]: https://spreecommerce.org/
[2]: https://github.com/vercel/commerce [2]: https://github.com/vercel/commerce
[3]: https://github.com/spree/spree_starter [3]: https://github.com/spree/spree_starter