Skip to content

Commit

Permalink
Merge pull request #70 from MichalBryxi/mb/52-uninstall-task
Browse files Browse the repository at this point in the history
fix: Uninstall task fails gracefully when given packages are not found
  • Loading branch information
mansona authored Sep 18, 2024
2 parents 81c8e0d + 7d50947 commit 76b0a68
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,28 @@ module.exports = {
});

let uninstallTask = this.taskFor('npm-uninstall');
await uninstallTask.run({
'save-dev': true,
verbose: false,
packages: [
'ember-fetch',
'broccoli-asset-rev',
'ember-cli-app-version',
'ember-cli-clean-css',
'ember-cli-dependency-checker',
'ember-cli-sri',
'ember-cli-terser',
],
packageManager: options.packageManager,
});
const packages = [
'ember-fetch',
'broccoli-asset-rev',
'ember-cli-app-version',
'ember-cli-clean-css',
'ember-cli-dependency-checker',
'ember-cli-sri',
'ember-cli-terser',
];

for (const package of packages) {
try {
await uninstallTask.run({
'save-dev': true,
verbose: false,
packages: [package],
packageManager: options.packageManager,
});
} catch {
console.log(`Could not uninstall ${package}`);
}
}
},

async afterInstall(options) {
Expand Down

0 comments on commit 76b0a68

Please sign in to comment.