function callYarnOrNpm(yarnCommand, npmCommand) {
  let command;

  const projectDir = process.cwd();
  const isYarnAvailable =
    yarn.getYarnVersionIfAvailable() &&
    yarn.isGlobalCliUsingYarn(projectDir);

  if (isYarnAvailable) {
    command = yarnCommand;
  } else {
    command = npmCommand;
  }

  const args = command.split(' ');
  const cmd = args.shift();

  const res = spawnSync(cmd, args, spawnOpts);

  return res;
}
Execute npm or yarn command

@param  {String} yarnCommand Yarn command to be executed eg. yarn add package
@param  {String} npmCommand  Npm command to be executed eg. npm install package
@return {object}             spawnSync's result object