tsbundle/ts/tsbundle.cli.ts
2022-03-18 15:46:11 +01:00

51 lines
1.4 KiB
TypeScript

import * as plugins from './plugins.js';
import { TsBundle } from './tsbundle.class.tsbundle.js';
import { HtmlHandler } from './mod_html/index.js';
import { logger } from './tsbundle.logging.js';
export const runCli = async () => {
const tsBundleCli = new plugins.smartcli.Smartcli();
tsBundleCli.standardTask().subscribe(async (argvArg) => {
const tsbundle = new TsBundle();
await tsbundle.build(process.cwd(), argvArg.from, argvArg.to, argvArg);
return;
});
tsBundleCli.addCommand('element').subscribe(async (argvArg) => {
const tsbundle = new TsBundle();
const htmlHandler = new HtmlHandler();
// const htmlHandler = new HtmlHandler();
await tsbundle.build(
process.cwd(),
'./ts_web/index.ts',
'./dist_bundle/bundle.js',
argvArg
);
});
tsBundleCli.addCommand('npm').subscribe(async (argvArg) => {
const tsbundle = new TsBundle();
const htmlHandler = new HtmlHandler();
await tsbundle.build(
process.cwd(),
'./ts/index.ts',
'./dist_bundle/bundle.js',
argvArg
);
});
tsBundleCli.addCommand('website').subscribe(async (argvArg) => {
const tsbundle = new TsBundle();
const htmlHandler = new HtmlHandler();
await tsbundle.build(
process.cwd(),
'./ts_web/index.ts',
'./dist_serve/bundle.js',
argvArg
);
await htmlHandler.minifyHtml('./html/index.html', './dist_serve/index.html')
});
tsBundleCli.startParse();
};