Used to remove multiple packages from the project's `package.json`. Generally, this would be done from the `afterInstall` hook, to ensure that any package conflicts can be resolved before the addon is used. Expects each array item to be an object with a `name` property. @metho
(packages)
| 1158 | @return {Promise} |
| 1159 | */ |
| 1160 | removePackagesFromProject(packages) { |
| 1161 | let task = this.taskFor('npm-uninstall'); |
| 1162 | let installText = packages.length > 1 ? 'uninstall packages' : 'uninstall package'; |
| 1163 | let packageNames = []; |
| 1164 | |
| 1165 | let projectDependencies = this.project.dependencies(); |
| 1166 | |
| 1167 | for (let i = 0; i < packages.length; i++) { |
| 1168 | let packageName = packages[i].name; |
| 1169 | if (packageName in projectDependencies) { |
| 1170 | packageNames.push(packageName); |
| 1171 | } |
| 1172 | } |
| 1173 | |
| 1174 | if (packageNames.length === 0) { |
| 1175 | this._writeStatusToUI(chalk.yellow, 'remove', 'Skipping uninstall because no matching package is installed.'); |
| 1176 | return Promise.resolve(); |
| 1177 | } |
| 1178 | |
| 1179 | this._writeStatusToUI(chalk.green, installText, packageNames.join(', ')); |
| 1180 | |
| 1181 | return task.run({ |
| 1182 | 'save-dev': true, |
| 1183 | verbose: false, |
| 1184 | packages: packageNames, |
| 1185 | }); |
| 1186 | }, |
| 1187 | |
| 1188 | /** |
| 1189 | Used to add an addon to the project's `package.json` and run it's |
nothing calls this directly
no test coverage detected
searching dependent graphs…