From 978539956588f30b2ff2b113160bee359b6fc78b Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sat, 14 Mar 2020 22:40:09 +0000 Subject: [PATCH] fix(core): update --- ts/tsbundle.cli.ts | 26 +++++++++++++++++++++----- ts/tsbundle.htmlhandler.ts | 2 +- ts/tsbundle.paths.ts | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ts/tsbundle.cli.ts b/ts/tsbundle.cli.ts index c44b012..80e6d94 100644 --- a/ts/tsbundle.cli.ts +++ b/ts/tsbundle.cli.ts @@ -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(); }; diff --git a/ts/tsbundle.htmlhandler.ts b/ts/tsbundle.htmlhandler.ts index 9c6d49a..e7fd2b6 100644 --- a/ts/tsbundle.htmlhandler.ts +++ b/ts/tsbundle.htmlhandler.ts @@ -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); diff --git a/ts/tsbundle.paths.ts b/ts/tsbundle.paths.ts index 8ecaeb3..9a9b00a 100644 --- a/ts/tsbundle.paths.ts +++ b/ts/tsbundle.paths.ts @@ -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');