'use strict';

// LOCAL
const tools = require('../../utils/tools');

// INNER MODULES
const innerProjects = require('./projects');


module.exports.install = (prj, envTarget) => {
  tools.logInfo('install.buildApp.install');

  return Promise.resolve()
    // checking remotes
    .then(() => {
      if (prj.standalone && !envTarget) {
        return innerProjects.installDepsStandalone(prj);
      } else {
        return innerProjects.installDeps(prj, envTarget);
      }
    })

    // returning metadata dependencies
    .then((deps) => {
      return deps;
    })

    .catch((e) => {
      throw e;
    })
}
