2019-06-16 15:02:38 +00:00
|
|
|
import * as plugins from './tsbundle.plugins';
|
|
|
|
import { TsBundle } from './tsbundle.class.tsbundle';
|
2019-06-16 15:47:34 +00:00
|
|
|
import { HtmlHandler } from './tsbundle.htmlhandler';
|
2019-06-16 15:02:38 +00:00
|
|
|
import { logger } from './tsbundle.logging';
|
|
|
|
|
|
|
|
export const runCli = async () => {
|
|
|
|
const tsBundleCli = new plugins.smartcli.Smartcli();
|
|
|
|
tsBundleCli.standardTask().subscribe(async argvArg => {
|
|
|
|
const tsbundle = new TsBundle();
|
2019-06-16 15:47:34 +00:00
|
|
|
const htmlHandler = new HtmlHandler();
|
2019-06-16 15:02:38 +00:00
|
|
|
switch (true) {
|
|
|
|
case argvArg.production:
|
|
|
|
await tsbundle.buildProduction();
|
2019-06-16 15:47:34 +00:00
|
|
|
await htmlHandler.minifyHtml();
|
2019-06-16 15:02:38 +00:00
|
|
|
break;
|
|
|
|
case argvArg.test:
|
|
|
|
await tsbundle.buildTest();
|
2019-06-16 15:47:34 +00:00
|
|
|
await htmlHandler.copyHtml();
|
2019-06-16 15:02:38 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
logger.log('error', `Can not determine build target environement. Please specify via --production or --test`)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
tsBundleCli.startParse();
|
|
|
|
};
|