'use babel';

import yarnExec from '../yarn/exec';
import reportError from '../report-error';

const cleanCache = async () => {
  const success = await yarnExec(null, 'cache', ['clean']);

  if (!success) {
    atom.notifications.addError(
      'An error occurred whilst cleaning cache. See output for more information.',
    );

    return;
  }

  atom.notifications.addSuccess('Global package cache has been cleaned');
};

const confirmation = async () => {
  atom.confirm({
    message: 'Are you sure you want to clean the global Yarn cache?',
    detailedMessage:
      'Cleaning your global package cache will force Yarn to download packages from the npm registry the next time a package is requested.',
    buttons: {
      'Clean Cache': () => {
        cleanCache().catch(reportError);
      },
      Cancel: null,
    },
  });
};

export default confirmation;

@@ -91,41 +91,258 @@
 r';%0A
-%0Aconst cleanCache = async () =%3E %7B
+import addProgressNotification from '../add-progress-notification';%0A%0Aconst cleanCache = async () =%3E %7B%0A  let progress;%0A%0A  const options = %7B%0A    onStart: () =%3E %7B%0A      progress = addProgressNotification('Cleaning global package cache...');%0A    %7D,%0A  %7D;%0A
 %0A  c
@@ -395,16 +395,48 @@
 'clean'%5D
+, options);%0A%0A  progress.dismiss(
 );%0A%0A  if
@@ -523,16 +523,23 @@
 leaning 
+global 
 cache. S

Add progress notification to clean cache command