var settings = require('../../settings.json');

/**
 * Returns true if the build is running in production mode
 *
 * @returns {Boolean} True if production mode is enabled
 */
var isProductionBuild = function() {
  if(process.env.NODE_ENV && process.env.NODE_ENV === 'prod') {
    return true;
  }
  
  return false;
};

/**
 * Get the root build folder by checking the NODE_ENV variable
 *
 * @returns {String} The root folder for the build
 */
var getBuildRootFolder = function() {
  if(isProductionBuild()) {
    return settings.build.prodDir;
  }
  
  return settings.build.devDir;
};

module.exports = {
  isProductionBuild: isProductionBuild,
  getBuildRootFolder: getBuildRootFolder
}

var config = require('../../config.json');
var fs = require('fs');

/**
 * Returns true if the build is running in production mode
 *
 * @returns {Boolean} True if production mode is enabled
 */
var isProductionBuild = function() {
  if(process.env.NODE_ENV && process.env.NODE_ENV === 'prod') {
    return true;
  }
  
  return false;
};

/**
 * Get the root build folder by checking the NODE_ENV variable
 *
 * @returns {String} The root folder for the build
 */
var getBuildRootFolder = function() {
  if(isProductionBuild()) {
    return config.build.prodDir;
  }
  
  return config.build.devDir;
};

/**
 * Create the build folder if it doesn't exist
 */
var createBuildRootFolderIfNotAvailable = function() {
  var buildFolder = getBuildRootFolder();

  if (!fs.existsSync(buildFolder)) {
    fs.mkdirSync(buildFolder);
  }
};

module.exports = {
  isProductionBuild: isProductionBuild,
  getBuildRootFolder: getBuildRootFolder,
  createBuildRootFolderIfNotAvailable: createBuildRootFolderIfNotAvailable
}

Add helper to create build folder
Add helper to create build folder
