module.exports = {

  build_dll: function() {
    return new Promise(function (resolve, reject) {

      console.log("_postinstall > NPM: DLL build started. Please wait..");
      require('child_process').execSync('npm run build:dll', {stdio:[0,1,2]});
      console.log("_postinstall > NPM: DLL build completed");
      resolve();

    });
  },

  compile_aot: function() {
    return new Promise(function (resolve, reject) {

      console.log("_postinstall > NPM: AOT compilation has started. Please wait..");
      require('child_process').execSync('npm run compile', {stdio:[0,1,2]});
      console.log("_postinstall > NPM: AOT compilation completed");
      resolve();

    });
  },

  build_web: function() {
    return new Promise(function (resolve, reject) {

      console.log("_postinstall > NPM: Building web (heroku) distro. Please wait..");
      require('child_process').execSync('npm run build:aot -- heroku', {stdio:[0,1,2]});
      console.log("_postinstall > NPM: Web distro build completed. Ready to serve");
      resolve();

    });
  },    

  build_ionic_resources: function() {
    return new Promise(function (resolve, reject) {

      console.log("_postinstall > NPM: Building Ionic resources. Please wait..");
      require('child_process').execSync('npm run utils:ionic:resources', {stdio:[0,1,2]});
      console.log("_postinstall > NPM: Ionic resources built.");
      resolve();

    });
  },  

  set_timezone: function() {
    return new Promise(function (resolve, reject) {
      console.log("_postinstall > NPM: Set timezone to UTC");
      exec(`export TZ=UTC`, (error, stdout, stderr) => {
        if (error) reject(error);
        console.log(`_postinstall > NPM: Timezone has been set to UTC`);
        resolve();
};
      });
    });
  },
