From dddd3ead1cc3748ce2af00baaf831a42816b96d9 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Mon, 9 Mar 2020 14:36:55 +0000 Subject: [PATCH] fix(core): update --- package-lock.json | 6 +++--- package.json | 2 +- ts/tsbundle.cli.ts | 16 ++++++++++++++++ ts/tsbundle.htmlhandler.ts | 8 ++++---- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 837c079..981d4d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1222,9 +1222,9 @@ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" }, "@types/node": { - "version": "13.7.7", - "resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-13.7.7.tgz", - "integrity": "sha512-Uo4chgKbnPNlxQwoFmYIwctkQVkMMmsAoGGU4JKwLuvBefF0pCq4FybNSnfkfRCpC7ZW7kttcC/TrRtAJsvGtg==" + "version": "13.9.0", + "resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-13.9.0.tgz", + "integrity": "sha512-0ARSQootUG1RljH2HncpsY2TJBfGQIKOOi7kxzUY6z54ePu/ZD+wJA8zI2Q6v8rol2qpG/rvqsReco8zNMPvhQ==" }, "@types/relateurl": { "version": "0.2.28", diff --git a/package.json b/package.json index b965c8c..dc8ab97 100644 --- a/package.json +++ b/package.json @@ -20,11 +20,11 @@ "@gitzone/tsrun": "^1.2.8", "@gitzone/tstest": "^1.0.28", "@pushrocks/tapbundle": "^3.2.0", - "@types/node": "^13.7.7", "tslint": "^6.0.0", "tslint-config-prettier": "^1.15.0" }, "dependencies": { + "@types/node": "^13.9.0", "@babel/core": "^7.6.2", "@babel/plugin-proposal-class-properties": "^7.5.5", "@babel/plugin-proposal-decorators": "^7.6.0", diff --git a/ts/tsbundle.cli.ts b/ts/tsbundle.cli.ts index e888620..4bbc08b 100644 --- a/ts/tsbundle.cli.ts +++ b/ts/tsbundle.cli.ts @@ -21,5 +21,21 @@ export const runCli = async () => { } }); + tsBundleCli.addCommand('element').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_ts_web/bundle.js'); + // await htmlHandler.minifyHtml(); + break; + case argvArg.test: + default: + await tsbundle.buildTest(argvArg.from, argvArg.to); + // await htmlHandler.copyHtml(); + return; + } + }); + tsBundleCli.startParse(); }; diff --git a/ts/tsbundle.htmlhandler.ts b/ts/tsbundle.htmlhandler.ts index fd7a762..9c6d49a 100644 --- a/ts/tsbundle.htmlhandler.ts +++ b/ts/tsbundle.htmlhandler.ts @@ -10,15 +10,15 @@ export class HtmlHandler { } // copies the html - public async copyHtml() { + public async copyHtml(targetPathArg = this.targetFilePath) { if (!(await this.checkIfExists())) { return; } - await plugins.smartfile.fs.copy(this.sourceFilePath, this.targetFilePath); + await plugins.smartfile.fs.copy(this.sourceFilePath, targetPathArg); } // copies and minifies the html - public async minifyHtml() { + public async minifyHtml(targetPathArg = this.targetFilePath) { if (!(await this.checkIfExists())) { return; } @@ -33,6 +33,6 @@ export class HtmlHandler { collapseInlineTagWhitespace: true, removeComments: true }); - plugins.smartfile.memory.toFsSync(minifiedHtml, this.targetFilePath); + plugins.smartfile.memory.toFsSync(minifiedHtml, targetPathArg); } }