'use strict';

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

// INNER MODULES
const innerPackages = require('./packages');
const innerRemotes = require('./remotes');




module.exports.installPackage = (prj, pkg, isMaster) => {
  return Promise.resolve()
    // checking remotes
    .then(() => {
      return innerPackages.installDeps(prj, pkg, isMaster);
    })

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

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

module.exports.installRemote = (pkg, envTarget) => {
  let deps;

  return Promise.resolve()
    // checking remotes
    .then(() => {
      return innerRemotes.installDeps(pkg, envTarget);
    })
    .then((outputDeps) => {
      deps = outputDeps;
    })

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

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