function harpCompile()

in gulpfile.js [821:865]


function harpCompile() {
  // Supposedly running in production makes harp faster
  // and less likely to drown in node_modules.
  env({ vars: { NODE_ENV: "production" } });
  gutil.log("NODE_ENV: " + process.env.NODE_ENV);

  if(argv.page) harpJsonSetJade2NgTo(true);

  if(skipLangs && fs.existsSync(WWW) && backupApiHtmlFilesExist(WWW)) {
    gutil.log(`Harp site recompile: skipping recompilation of API docs for [${skipLangs}]`);
    gutil.log(`API docs will be copied from existing ${WWW} folder (if they exist).`)
    del.sync(`${WWW}-backup`); // remove existing backup if it exists
    renameIfExistsSync(WWW, `${WWW}-backup`);
  } else {
    gutil.log(`Harp full site compile, including API docs for all languages.`);
    if (skipLangs)
      gutil.log(`Ignoring API docs skip set (${skipLangs}) because full ` +
      `site has not been built yet or some API HTML files are missing.`);
  }

  var deferred = Q.defer();
  gutil.log('running harp compile...');
  showHideExampleNodeModules('hide');
  showHideApiDir('hide');
  var spawnInfo = spawnExt('npm',['run','harp', '--', 'compile', '.', WWW ]);
  spawnInfo.promise.then(function(x) {
    gutil.log("NODE_ENV: " + process.env.NODE_ENV);
    showHideExampleNodeModules('show');
    showHideApiDir('show');
    harpJsonSetJade2NgTo(false);
    if (x !== 0) {
      deferred.reject(x)
    } else {
      restoreApiHtml();
      deferred.resolve(x);
    }
  }).catch(function(e) {
    gutil.log("NODE_ENV: " + process.env.NODE_ENV);
    showHideExampleNodeModules('show');
    showHideApiDir('show');
    harpJsonSetJade2NgTo(false);
    deferred.reject(e);
  });
  return deferred.promise;
}