From c4e5a50e09fe44f17c3ac7f81a36b2a9146c3b21 Mon Sep 17 00:00:00 2001 From: Solly Ross Date: Tue, 3 Oct 2017 18:21:36 -0400 Subject: [PATCH] [infra] option to clean on use_require.js This adds an option to `utils/use_require.js` which cleans the lib and build directories before regenerating them. This will enable us to make sure we always have a fresh copy of the lib dir before publishing. --- utils/use_require.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/utils/use_require.js b/utils/use_require.js index 30d4cbd3..fea1b1df 100755 --- a/utils/use_require.js +++ b/utils/use_require.js @@ -11,6 +11,7 @@ program .option('--as [format]', `output files using various import formats instead of ES6 import and export. Supports ${Array.from(SUPPORTED_FORMATS)}.`) .option('-m, --with-source-maps [type]', 'output source maps when not generating a bundled app (type may be empty for external source maps, inline for inline source maps, or both) ') .option('--with-app', 'process app files as well as core files') + .option('--clean', 'clear the lib folder before building') .parse(process.argv); // the various important paths @@ -177,4 +178,12 @@ var make_lib_files = function (import_format, source_maps, with_app_dir) { } }; +if (program.clean) { + console.log(`Removing ${paths.lib_dir_base}`); + fse.removeSync(paths.lib_dir_base); + + console.log(`Removing ${paths.out_dir_base}`); + fse.removeSync(paths.out_dir_base); +} + make_lib_files(program.as, program.withSourceMaps, program.withApp);