const fs = require('fs');
const path = require('path');
const rimraf = require('rimraf');
const webpackPaths = require('../configs/webpack.paths').default;

function deleteSourceMaps() {
  if (fs.existsSync(webpackPaths.distMainPath))
    rimraf.sync(path.join(webpackPaths.distMainPath, '*.js.map'), {
      glob: true,
    });
  if (fs.existsSync(webpackPaths.distRendererPath))
    rimraf.sync(path.join(webpackPaths.distRendererPath, '*.js.map'), {
      glob: true,
    });
}

module.exports = deleteSourceMaps;
