Tue Jul 18 2017
Copied to clipboard! Copy reply
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
console.log("Preparing webpages for campaign flip.");

const color = require('colors');
var shell = require('shelljs');

var select_mode = "build-flip-pages";
var available_build_mode = ["build-all-pages", "build-flip-pages"];

validateMode(select_mode);

if( select_mode == "build-flip-pages" ){
    if (shell.exec('npm run build-flip-pages').code !== 0) {  
      shell.exit(1);
    }
}


if( select_mode == "build-all-pages" ){
    if (shell.exec('npm run build-all-pages').code !== 0) {  
      shell.exit(1);
    }
}


function validateMode( select_mode ){
    if( available_build_mode.indexOf(select_mode) == -1 ){
        throw Error("Selected mode not available");
    }
}