addPackagesToProject(packages) {
    let task = this.taskFor('npm-install');
    let installText = packages.length > 1 ? 'install packages' : 'install package';
    let packageNames = [];
    let packageArray = [];

    for (let i = 0; i < packages.length; i++) {
      packageNames.push(packages[i].name);

      let packageNameAndVersion = packages[i].name;

      if (packages[i].target) {
        packageNameAndVersion += `@${packages[i].target}`;
      }

      packageArray.push(packageNameAndVersion);
    }

    this._writeStatusToUI(chalk.green, installText, packageNames.join(', '));

    return task.run({
      'save-dev': true,
      verbose: false,
      packages: packageArray,
    });
  }
Used to add multiple packages to the project's `package.json`.

    Generally, this would be done from the `afterInstall` hook, to
    ensure that a package that is required by a given blueprint is
    available.

    Expects each array item to be an object with a `name`.  Each object
    may optionally have a `target` to specify a specific version.

    @method addPackagesToProject
    @param {Array} packages
    @return {Promise}

    @example
    ```js
    this.addPackagesToProject([
      { name: 'lodash' },
      { name: 'moment', target: '^2.17.0' },
    ]);
    ```