From 6c84fdc51ddb11970e1b641c5a683d649c8201aa Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sat, 10 Oct 2020 13:02:37 +0100 Subject: [PATCH] Tools: Added clean script --- Tools/gulp/tasks/deleteBuildDirs.js | 11 +++++++++++ gulpfile.js | 5 +++++ package.json | 1 + 3 files changed, 17 insertions(+) create mode 100644 Tools/gulp/tasks/deleteBuildDirs.js diff --git a/Tools/gulp/tasks/deleteBuildDirs.js b/Tools/gulp/tasks/deleteBuildDirs.js new file mode 100644 index 000000000..7ce7ea8f7 --- /dev/null +++ b/Tools/gulp/tasks/deleteBuildDirs.js @@ -0,0 +1,11 @@ +const utils = require('../utils'); +const rootDir = utils.rootDir(); +const fs = require('fs-extra'); + +module.exports = { + src: '', + fn: async function() { + await fs.remove(`${rootDir}/CliClient/tests-build`); + await fs.remove(`${rootDir}/CliClient/build`); + }, +}; diff --git a/gulpfile.js b/gulpfile.js index 3299ea485..d40f3bf33 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -5,8 +5,13 @@ const tasks = { copyLib: require('./Tools/gulp/tasks/copyLib'), tsc: require('./Tools/gulp/tasks/tsc'), updateIgnoredTypeScriptBuild: require('./Tools/gulp/tasks/updateIgnoredTypeScriptBuild'), + deleteBuildDirs: require('./Tools/gulp/tasks/deleteBuildDirs'), }; utils.registerGulpTasks(gulp, tasks); gulp.task('build', gulp.series('copyLib', 'tsc', 'updateIgnoredTypeScriptBuild')); + +// The clean task removes build directories and copy back the library. This is useful +// when switching from one branch to another. +gulp.task('clean', gulp.series('deleteBuildDirs', 'copyLib')); diff --git a/package.json b/package.json index b43c7c0fd..43d928302 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "watch": "node node_modules/typescript/bin/tsc --watch --project tsconfig.dev.json", "build": "gulp build", "setupNewRelease": "node ./Tools/setupNewRelease", + "clean": "npm run clean", "postinstall": "cd Tools && npm i && cd .. && cd ReactNativeClient && npm i && cd .. && cd ElectronClient && npm i && cd .. && cd CliClient && npm i && cd .. && gulp build" }, "husky": {