From ef1ce37776ecff6c164ec819b95f33a758f47e93 Mon Sep 17 00:00:00 2001 From: metalex9 Date: Tue, 19 Mar 2019 00:54:22 -0500 Subject: [PATCH] Support deployments to staging and production --- node_scripts/deploy.js | 5 ++++- package.json | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/node_scripts/deploy.js b/node_scripts/deploy.js index 721f2af..ee1619d 100644 --- a/node_scripts/deploy.js +++ b/node_scripts/deploy.js @@ -9,7 +9,10 @@ const { gzip } = require('node-gzip'); const { lookup } = require('mime-types'); const envs = require('./secrets'); -const { bucketName, cloudfrontDistributionId } = envs.staging; +const { bucketName, cloudfrontDistributionId } = + process.argv.length >= 3 && process.argv[2] === '-p' + ? envs.production + : envs.staging; const DIST_DIR = 'dist'; const S3_API_VERSION = '2006-03-01'; diff --git a/package.json b/package.json index dd659b5..b280788 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,9 @@ "test": "echo \"Error: no test specified\" && exit 1", "start": "webpack-dev-server", "build": "cross-env NODE_ENV=production webpack-cli --mode production --config webpack.prod.config.js", - "deploy": "npm run lint && npm run build && node node_scripts/deploy.js", + "predeploy": "npm run lint && npm run build", + "deploy:staging": "npm run predeploy && node node_scripts/deploy.js", + "deploy:production": "npm run predeploy && node node_scripts/deploy.js -p", "lint": "eslint .", "postversion": "git push && git push --tags" },