diff --git a/build/build.js b/build/build.js index 2129f0d0f..39ca7bc41 100644 --- a/build/build.js +++ b/build/build.js @@ -2,8 +2,10 @@ 'use strict' +const cleanOutputDirectory = require('./lib/clean-output-directory') const transpileBabelPaths = require('./lib/transpile-babel-paths') const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths') +cleanOutputDirectory() transpileBabelPaths() transpileCoffeeScriptPaths() diff --git a/build/lib/clean-output-directory.js b/build/lib/clean-output-directory.js new file mode 100644 index 000000000..56613ed50 --- /dev/null +++ b/build/lib/clean-output-directory.js @@ -0,0 +1,10 @@ +const fs = require('fs-extra') +const path = require('path') +const CONFIG = require('../config') + +module.exports = function () { + if (fs.existsSync(CONFIG.buildOutputPath)) { + console.log(`Cleaning ${CONFIG.buildOutputPath}...`); + fs.removeSync(CONFIG.buildOutputPath) + } +} diff --git a/build/package.json b/build/package.json index ad2bbe28d..0b2c461cf 100644 --- a/build/package.json +++ b/build/package.json @@ -2,7 +2,8 @@ "name": "atom-build-scripts", "description": "Atom build scripts", "dependencies": { - "glob": "^7.0.3", - "mkdirp": "^0.5.1" + "fs-extra": "0.30.0", + "glob": "7.0.3", + "mkdirp": "0.5.1" } }