2022-03-15 23:21:05 +00:00
|
|
|
import * as plugins from './plugins.js';
|
2022-03-14 15:32:12 +00:00
|
|
|
import { TsBundle } from './tsbundle.class.tsbundle.js';
|
2022-03-18 14:46:11 +00:00
|
|
|
import { HtmlHandler } from './mod_html/index.js';
|
2022-03-14 15:32:12 +00:00
|
|
|
import { logger } from './tsbundle.logging.js';
|
2019-06-16 15:02:38 +00:00
|
|
|
|
|
|
|
export const runCli = async () => {
|
|
|
|
const tsBundleCli = new plugins.smartcli.Smartcli();
|
2022-03-14 15:32:12 +00:00
|
|
|
tsBundleCli.standardTask().subscribe(async (argvArg) => {
|
2019-06-16 15:02:38 +00:00
|
|
|
const tsbundle = new TsBundle();
|
2022-03-15 23:21:05 +00:00
|
|
|
await tsbundle.build(process.cwd(), argvArg.from, argvArg.to, argvArg);
|
|
|
|
return;
|
2019-06-16 15:02:38 +00:00
|
|
|
});
|
|
|
|
|
2022-03-14 15:32:12 +00:00
|
|
|
tsBundleCli.addCommand('element').subscribe(async (argvArg) => {
|
2020-03-09 14:36:55 +00:00
|
|
|
const tsbundle = new TsBundle();
|
2022-03-18 14:46:11 +00:00
|
|
|
const htmlHandler = new HtmlHandler();
|
2020-03-09 14:36:55 +00:00
|
|
|
// const htmlHandler = new HtmlHandler();
|
2022-03-15 23:21:05 +00:00
|
|
|
await tsbundle.build(
|
|
|
|
process.cwd(),
|
|
|
|
'./ts_web/index.ts',
|
|
|
|
'./dist_bundle/bundle.js',
|
|
|
|
argvArg
|
|
|
|
);
|
2020-03-09 14:36:55 +00:00
|
|
|
});
|
|
|
|
|
2022-03-14 15:32:12 +00:00
|
|
|
tsBundleCli.addCommand('npm').subscribe(async (argvArg) => {
|
2020-05-25 16:29:22 +00:00
|
|
|
const tsbundle = new TsBundle();
|
2022-03-18 14:46:11 +00:00
|
|
|
const htmlHandler = new HtmlHandler();
|
2022-03-15 23:21:05 +00:00
|
|
|
await tsbundle.build(
|
|
|
|
process.cwd(),
|
|
|
|
'./ts/index.ts',
|
|
|
|
'./dist_bundle/bundle.js',
|
|
|
|
argvArg
|
|
|
|
);
|
2020-05-25 16:29:22 +00:00
|
|
|
});
|
|
|
|
|
2022-03-14 15:32:12 +00:00
|
|
|
tsBundleCli.addCommand('website').subscribe(async (argvArg) => {
|
2020-03-14 22:40:09 +00:00
|
|
|
const tsbundle = new TsBundle();
|
2022-03-18 14:46:11 +00:00
|
|
|
const htmlHandler = new HtmlHandler();
|
2022-03-15 23:21:05 +00:00
|
|
|
await tsbundle.build(
|
|
|
|
process.cwd(),
|
|
|
|
'./ts_web/index.ts',
|
|
|
|
'./dist_serve/bundle.js',
|
|
|
|
argvArg
|
|
|
|
);
|
2022-03-18 14:46:11 +00:00
|
|
|
await htmlHandler.minifyHtml('./html/index.html', './dist_serve/index.html')
|
2020-03-14 22:40:09 +00:00
|
|
|
});
|
|
|
|
|
2019-06-16 15:02:38 +00:00
|
|
|
tsBundleCli.startParse();
|
|
|
|
};
|