fix(core): update

This commit is contained in:
Philipp Kunz 2020-03-14 22:40:09 +00:00
parent d1bb93e9e1
commit 9785399565
3 changed files with 23 additions and 7 deletions

View File

@ -7,16 +7,16 @@ export const runCli = async () => {
const tsBundleCli = new plugins.smartcli.Smartcli();
tsBundleCli.standardTask().subscribe(async argvArg => {
const tsbundle = new TsBundle();
const htmlHandler = new HtmlHandler();
// const htmlHandler = new HtmlHandler();
switch (true) {
case argvArg.production || process.env.CI:
await tsbundle.buildProduction(argvArg.from, argvArg.to);
await htmlHandler.minifyHtml();
// await htmlHandler.minifyHtml();
break;
case argvArg.test:
default:
await tsbundle.buildTest(argvArg.from, argvArg.to);
await htmlHandler.copyHtml();
// await htmlHandler.copyHtml();
return;
}
});
@ -26,16 +26,32 @@ export const runCli = async () => {
// const htmlHandler = new HtmlHandler();
switch (true) {
case argvArg.production || process.env.CI:
await tsbundle.buildProduction('./ts_web/index.ts', './dist_ts_web/bundle.js');
await tsbundle.buildProduction('./ts_web/index.ts', './dist_bundle/bundle.js');
// await htmlHandler.minifyHtml();
break;
case argvArg.test:
default:
await tsbundle.buildTest('./ts_web/index.ts', './dist_ts_web/bundle.js');
await tsbundle.buildTest('./ts_web/index.ts', './dist_bundle/bundle.js');
// await htmlHandler.copyHtml();
return;
}
});
tsBundleCli.addCommand('website').subscribe(async argvArg => {
const tsbundle = new TsBundle();
const htmlHandler = new HtmlHandler();
switch (true) {
case argvArg.production || process.env.CI:
await tsbundle.buildProduction('./ts_web/index.ts', './dist_serve/bundle.js');
await htmlHandler.minifyHtml();
break;
case argvArg.test:
default:
await tsbundle.buildTest('./ts_web/index.ts', './dist_serve/bundle.js');
await htmlHandler.copyHtml();
return;
}
});
tsBundleCli.startParse();
};

View File

@ -3,7 +3,7 @@ import * as paths from './tsbundle.paths';
export class HtmlHandler {
public sourceFilePath: string = plugins.path.join(paths.htmlDir, 'index.html');
public targetFilePath: string = plugins.path.join(paths.distWebDir, 'index.html');
public targetFilePath: string = plugins.path.join(paths.distServeDir, 'index.html');
public async checkIfExists() {
return plugins.smartfile.fs.fileExists(this.sourceFilePath);

View File

@ -3,5 +3,5 @@ import * as plugins from './tsbundle.plugins';
export const cwd = process.cwd();
export const packageDir = plugins.path.join(__dirname, '../');
export const htmlDir = plugins.path.join(cwd, './html');
export const distWebDir = plugins.path.join(cwd, './dist_ts_web');
export const distServeDir = plugins.path.join(cwd, './dist_serve');
export const assetsDir = plugins.path.join(packageDir, 'assets');