[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.
This commit is contained in:
Solly Ross 2017-10-03 18:21:36 -04:00
parent b1e26cf4e7
commit c4e5a50e09
1 changed files with 9 additions and 0 deletions

View File

@ -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);