import chalk from 'chalk';
import { BUILD_DIR, DIST_DIR, DIST_STORYBOOK_DIR, ICONSAUCE_DIR, LOADER_DIR, DIST_CUSTOM_DIR, WWW_DIR } from './meta';
import { rm } from 'fs/promises';
import { logDirectoryDeleted } from './log';
const cleanDir = async (dir) => {
  rm(dir, { force: true, recursive: true })
    .then(() => {
    logDirectoryDeleted(dir);
  })
    .catch(error => {
    throw Error(chalk.red(error));
  });
};
console.log('Cleaning build');
cleanDir(BUILD_DIR);
cleanDir(ICONSAUCE_DIR);
cleanDir(DIST_DIR);
cleanDir(DIST_CUSTOM_DIR);
cleanDir(DIST_STORYBOOK_DIR);
cleanDir(LOADER_DIR);
cleanDir(WWW_DIR);
