Name: reaction-next-starterkit
Owner: Reaction Commerce
Description: null
Created: 2018-04-03 21:50:03.0
Updated: 2018-05-24 08:49:11.0
Pushed: 2018-05-24 16:42:54.0
Homepage: null
Size: 2287
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Note: This project is a work in progress and should not be used in production at this time.
Reference Storefront application for Reaction Commerce.
Follow steps as necessary. If you already have Reaction installed, you may be able to skip some of these steps.
Prerequesites
Install Docker and Docker Compose. Docker Compose is included when installing Docker on Mac and Windows, but will need to be installed separately on Linux.
Clone the main Reaction repo and checkout the release-1.12.0
branch
clone git@github.com:reactioncommerce/reaction.git
eaction
checkout release-1.12.0
ange directory to the parent of your reaction install
.
Clone this repo
clone git@github.com:reactioncommerce/reaction-next-starterkit.git
Create a local docker network
You'll need to create a docker network for the GraphQL service and the Reaction Storefront to communicate
er network create reaction-api
You can run docker network ls
to verify the network has been created.
Start Reaction's GraphQL server
From your reaction
directory run
er-compose up -d --build
You'll need to run the full app at least once in order for step 5 to work. After this initial run, if you don't want to start the Reaction Meteor app, you can just run docker-compose up -d devserver
Generate a Meteor login token
This process will be eliminated once we've built out the GraphQL API for authentication
localStorage
.Setup the Storefront environment
Navigate to the reaction-next-starterkit
directory and create a .env
file.
env.example .env
Start the storefront application in development mode using Docker Compose
er-compose up -d --build
Visit the storefront on localhost:4000
er-compose up -d && docker-compose logs -f
er-compose run --rm web [command]
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.
Run tests locally
er-compose run --rm web yarn test
Run tests locally without cache (this can be helpful if changes aren't showing up)
er-compose run --rm web yarn test --no-cache
To update a failing snapshot (if you've made changes to a component)
er-compose run --rm web yarn test -u
To run snyk security tests (this will run tests in the same way as CI)
er-compose run --rm web sh -c "cp package.json ../ && cp .snyk ../ && cd .. && snyk auth && snyk test"
To run eslint
er-compose run --rm web eslint src
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. Yarn Add
er-compose run --rm web yarn add --dev [package]
Yarn Install
?? Always rebuild the image and start a new container after modifying yarn.lock or Dockerfile!
er-compose run --rm web yarn install
er-compose down --rmi local
er-compose up -d --build
Stop, and retain containers:
er-compose stop
Stop, and remove containers:
er-compose down
Stop, and remove containers, volumes and built images:
er-compose down -v --rmi local
Running the command below will build the starterkit for production.
er build -t reaction-storefront --build-arg BUILD_ENV=production .
To start the app in production mode execute:
er run -d --name storefront -p ${port}:4000 --env-file .env --network reaction-api reaction-storefront
To stop the docker container after starting it with the above command
er stop storefront
NOTE: Replace the ${port}
with the localhost port you'd like the application to run at. I'm partial to 4040
NOTE: The above command is assuming ether the devserver
or reaction
is also running.
See our full documentation