React Storefront makes it easy to deploy your project to Moovweb XDN (Experience Delivery Network). Simply create your project in Moov Console, update your deploy script, and deploy from the command line by running npm run deploy {environment}
, or configure automatic deployment with CircleCI. Here's how you can configure your project for deployment:
moov_config-*.json
files in the root of your project. For example, "my-project-prod" for moov_config-prod.json
and "my-project-stage" for moov_config-stage.json
.Open package.json
and find the "deploy" script. By default it should look something like this:
"deploy": "npm build && /bin/bash -c \"g() { npm run link -- $@ && moov deploy --ignore-live --deploy-id=\"`git rev-parse HEAD`\" --notes=\"`git log -1 --pretty=format:%s`\" moovweb/react-storefront-$@ && npm run link -- local; }; g\""
This script does the following:
moov_config.json
in the root of your project to the moov_config-*.json
file corresponding to the environment we're deploying tomoov deploy
to upload the built project to Moovweb XDNUpdate this script so that it uses your organization and project by replacing moovweb/react-storefront-$@
with {my-org}/{my-project-name}-$@
. For example, if your project is called "my-project-prod", use "my-project-$@".
To deploy your project to the Moovweb XDN, run:
npm run deploy {environment-name}
For example, to deploy to staging, run
npm run deploy stage
To deploy to production, run:
npm run deploy prod
The React Storefront Boilerplate contains an example CircleCI configuration in .circleci/config.yml
.
To deploy with CircleCI, make the following changes to .circleci/config.yml
:
# deploy to production
command: |
npm build
if [ $CIRCLE_BRANCH = 'master' ]; then
npm run link -- prod
moov deploy moovweb/react-storefront-prod -user-email=${MOOV_EMAIL} -user-password=${MOOV_PASSWORD} -ignore-live -deploy-id $(git rev-parse HEAD) -notes "$(git rev-parse --abbrev-ref HEAD) - $(git log -1 --pretty=%B)"
fi
If you're deploying to an environment other than production, update the line that reads npm run link -- prod
to deploy. The last part should match to the suffix of the moov-config-*.json
file corresponding to the environment to which you are deploying.
Update "moov deploy moovweb/react-storefront-prod" to the correct project name. For example, if your project is called "my-project-prod", use "moov deploy "my-org/my-project-prod"
MOOV_EMAIL
and MOOV_PASSWORD
environment variables in Circle CI.