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" },