From 34066d8a13ed014ea9b567e85beb9cd4a8010f6b Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Thu, 3 May 2018 12:35:41 +0200 Subject: [PATCH] switch to seperate build/test commands to inrpove speed --- dist/mod_test/index.d.ts | 4 +++ dist/mod_test/index.js | 4 +++ dist/npmts.cli.js | 20 ++++++++----- dist/npmts.config.d.ts | 2 +- dist/npmts.plugins.d.ts | 2 +- dist/npmts.plugins.js | 2 +- package.json | 8 ++--- ts/mod_test/index.ts | 4 +++ ts/npmts.cli.ts | 27 +++++++++++------ ts/npmts.config.ts | 2 +- ts/npmts.plugins.ts | 2 +- yarn.lock | 63 ++++++++++++++++++++++++++-------------- 12 files changed, 93 insertions(+), 47 deletions(-) diff --git a/dist/mod_test/index.d.ts b/dist/mod_test/index.d.ts index aa3ff3b..7d9e189 100644 --- a/dist/mod_test/index.d.ts +++ b/dist/mod_test/index.d.ts @@ -1,2 +1,6 @@ import { INpmtsConfig } from '../npmts.config'; +/** + * run this module + * @param configArg some config for how to run this module + */ export declare let run: (configArg: INpmtsConfig) => Promise; diff --git a/dist/mod_test/index.js b/dist/mod_test/index.js index 4f15b75..703986a 100644 --- a/dist/mod_test/index.js +++ b/dist/mod_test/index.js @@ -93,6 +93,10 @@ let handleCoverageData = (configArg) => __awaiter(this, void 0, void 0, function } return configArg; }); +/** + * run this module + * @param configArg some config for how to run this module + */ exports.run = function (configArg) { let done = q.defer(); let config = configArg; diff --git a/dist/npmts.cli.js b/dist/npmts.cli.js index 0b71930..d11d176 100644 --- a/dist/npmts.cli.js +++ b/dist/npmts.cli.js @@ -52,14 +52,13 @@ exports.run = () => __awaiter(this, void 0, void 0, function* () { yield plugins.smartupdate.standardHandler.check('npmts', npmtsProjectInfo.version, 'http://gitzone.gitlab.io/npmts/changelog.html'); plugins.beautylog.log('---------------------------------------------'); let npmtsCli = new plugins.smartcli.Smartcli(); + // build npmtsCli - .standardTask() - .then(argvArg => { - plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version); - return NpmtsConfig.run(argvArg); - }) - .then((configArg) => { + .addCommand('build') + .subscribe((argvArg) => __awaiter(this, void 0, void 0, function* () { let done = q.defer(); + plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version); + const configArg = yield NpmtsConfig.run(argvArg); plugins.beautylog.ora.start('loading additional modules...'); NpmtsMods.modCompile .load() @@ -93,13 +92,18 @@ exports.run = () => __awaiter(this, void 0, void 0, function* () { .then(NpmtsWatch.run) .then(NpmtsShip.run); return done.promise; - }) - .catch(err => { + }), err => { if (err instanceof Error) { console.log(err); } }); + // standard task + npmtsCli.standardTask().subscribe((argvArg) => __awaiter(this, void 0, void 0, function* () { + yield npmtsCli.trigger('build'); + })); + // cli metadata npmtsCli.addVersion(npmtsProjectInfo.version); + // start parsing npmtsCli.startParse(); return yield done.promise; }); diff --git a/dist/npmts.config.d.ts b/dist/npmts.config.d.ts index 1084762..50524fe 100644 --- a/dist/npmts.config.d.ts +++ b/dist/npmts.config.d.ts @@ -22,5 +22,5 @@ export interface INpmtsConfig { coverageResult?: number; }; } -export declare let run: (argvArg: any) => Promise<{}>; +export declare let run: (argvArg: any) => Promise; export declare let configPromise: Promise; diff --git a/dist/npmts.plugins.d.ts b/dist/npmts.plugins.d.ts index 93dfff9..acf55da 100644 --- a/dist/npmts.plugins.d.ts +++ b/dist/npmts.plugins.d.ts @@ -5,7 +5,7 @@ import * as npmextra from 'npmextra'; import * as projectinfo from 'projectinfo'; import * as path from 'path'; import * as smartanalytics from 'smartanalytics'; -import * as smartcli from 'smartcli'; +import * as smartcli from '@pushrocks/smartcli'; import * as smarterror from 'smarterror'; import * as smartfile from 'smartfile'; import * as smartpath from 'smartpath'; diff --git a/dist/npmts.plugins.js b/dist/npmts.plugins.js index 9c167ec..41e8e37 100644 --- a/dist/npmts.plugins.js +++ b/dist/npmts.plugins.js @@ -14,7 +14,7 @@ const path = require("path"); exports.path = path; const smartanalytics = require("smartanalytics"); exports.smartanalytics = smartanalytics; -const smartcli = require("smartcli"); +const smartcli = require("@pushrocks/smartcli"); exports.smartcli = smartcli; const smarterror = require("smarterror"); exports.smarterror = smarterror; diff --git a/package.json b/package.json index 6ecc25b..cf35901 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ }, "homepage": "https://gitlab.com/gitzone/npmts#readme", "dependencies": { + "@pushrocks/smartcli": "^3.0.0", "@types/gulp-sourcemaps": "0.0.32", "@types/minimatch": "^3.0.1", "@types/through2": "^2.0.33", @@ -43,12 +44,11 @@ "gulp-function": "^2.2.9", "gulp-sourcemaps": "^2.6.1", "gulp-typescript": "^4.0.2", - "lodash": "^4.17.4", + "lodash": "^4.17.10", "npmextra": "^2.0.9", "projectinfo": "^3.0.4", "smartanalytics": "^2.0.9", "smartchok": "1.0.14", - "smartcli": "^2.0.9", "smartcov": "^1.0.2", "smarterror": "^1.0.3", "smartfile": "^4.2.26", @@ -62,9 +62,9 @@ "tapbuffer": "^1.0.31", "through2": "^2.0.3", "tsn": "^2.0.15", - "typescript": "^2.8.1" + "typescript": "^2.8.3" }, "devDependencies": { - "@types/node": "^9.6.2" + "@types/node": "^10.0.3" } } diff --git a/ts/mod_test/index.ts b/ts/mod_test/index.ts index 2366303..5afd330 100644 --- a/ts/mod_test/index.ts +++ b/ts/mod_test/index.ts @@ -108,6 +108,10 @@ let handleCoverageData = async (configArg: INpmtsConfig) => { return configArg; }; +/** + * run this module + * @param configArg some config for how to run this module + */ export let run = function(configArg: INpmtsConfig) { let done = q.defer(); let config = configArg; diff --git a/ts/npmts.cli.ts b/ts/npmts.cli.ts index beb452a..275235d 100644 --- a/ts/npmts.cli.ts +++ b/ts/npmts.cli.ts @@ -51,14 +51,15 @@ export let run = async () => { ); plugins.beautylog.log('---------------------------------------------'); let npmtsCli = new plugins.smartcli.Smartcli(); + + // build npmtsCli - .standardTask() - .then(argvArg => { - plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version); - return NpmtsConfig.run(argvArg); - }) - .then((configArg: NpmtsConfig.INpmtsConfig) => { + .addCommand('build') + .subscribe(async (argvArg) => { let done = q.defer(); + plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version); + const configArg: NpmtsConfig.INpmtsConfig = await NpmtsConfig.run(argvArg); + plugins.beautylog.ora.start('loading additional modules...'); NpmtsMods.modCompile .load() @@ -93,13 +94,21 @@ export let run = async () => { .then(NpmtsShip.run); return done.promise; - }) - .catch(err => { + }, err => { if (err instanceof Error) { console.log(err); } - }); + }) + + // standard task + npmtsCli.standardTask().subscribe(async argvArg => { + await npmtsCli.trigger('build') + }) + + // cli metadata npmtsCli.addVersion(npmtsProjectInfo.version); + + // start parsing npmtsCli.startParse(); return await done.promise; }; diff --git a/ts/npmts.config.ts b/ts/npmts.config.ts index f411e29..dce7f45 100644 --- a/ts/npmts.config.ts +++ b/ts/npmts.config.ts @@ -32,7 +32,7 @@ export interface INpmtsConfig { } export let run = function(argvArg) { - let done = smartq.defer(); + let done = smartq.defer(); let defaultConfig: INpmtsConfig = { argv: undefined, coverageTreshold: 70, diff --git a/ts/npmts.plugins.ts b/ts/npmts.plugins.ts index 7a46bc1..f84ef66 100644 --- a/ts/npmts.plugins.ts +++ b/ts/npmts.plugins.ts @@ -6,7 +6,7 @@ import * as npmextra from 'npmextra'; import * as projectinfo from 'projectinfo'; import * as path from 'path'; import * as smartanalytics from 'smartanalytics'; -import * as smartcli from 'smartcli'; +import * as smartcli from '@pushrocks/smartcli'; import * as smarterror from 'smarterror'; import * as smartfile from 'smartfile'; import * as smartpath from 'smartpath'; diff --git a/yarn.lock b/yarn.lock index 67bce72..aba1d06 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19,6 +19,18 @@ normalize-path "^2.0.1" through2 "^2.0.3" +"@pushrocks/smartcli@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@pushrocks/smartcli/-/smartcli-3.0.0.tgz#1840db8c8e5504ac136ce4051f3906158338192a" + dependencies: + "@types/yargs" "^11.0.0" + beautylog "^6.1.10" + lik "^2.0.5" + rxjs "^6.0.0" + smartparam "1.0.2" + smartq "^1.1.8" + yargs "^11.0.0" + "@types/chokidar@^1.7.5": version "1.7.5" resolved "https://registry.yarnpkg.com/@types/chokidar/-/chokidar-1.7.5.tgz#1fa78c8803e035bed6d98e6949e514b133b0c9b6" @@ -58,10 +70,14 @@ version "3.0.3" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" -"@types/node@*", "@types/node@^9.6.2": +"@types/node@*": version "9.6.2" resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.2.tgz#e49ac1adb458835e95ca6487bc20f916b37aff23" +"@types/node@^10.0.3": + version "10.0.3" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.0.3.tgz#1f89840c7aac2406cc43a2ecad98fc02a8e130e4" + "@types/node@^8.0.10": version "8.10.3" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.3.tgz#ee34a5c732703cf45d2fadc163a299a6b2f456c2" @@ -100,9 +116,9 @@ version "1.3.1" resolved "https://registry.yarnpkg.com/@types/which/-/which-1.3.1.tgz#7802c380887986ca909008afea4e08025b130f8d" -"@types/yargs@^10.0.1": - version "10.0.2" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-10.0.2.tgz#cc4ea921877874d1261e2c44b89807bc836e1b12" +"@types/yargs@^11.0.0": + version "11.0.0" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-11.0.0.tgz#124b9ed9c65b7091cc36da59ae12cbd47d8745ea" abbrev@1: version "1.1.1" @@ -562,8 +578,8 @@ cliui@^3.2.0: wrap-ansi "^2.0.0" cliui@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.0.0.tgz#743d4650e05f36d1ed2575b59638d87322bfbbcc" + version "4.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" dependencies: string-width "^2.1.1" strip-ansi "^4.0.0" @@ -1859,7 +1875,7 @@ lik@^1.0.38: smartq "^1.1.6" typings-global "^1.0.20" -lik@^2.0.1, lik@^2.0.2, lik@^2.0.5: +lik@^2.0.1, lik@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/lik/-/lik-2.0.5.tgz#1338a3201828b557fa91a5b8a6013743ff720e10" dependencies: @@ -1979,6 +1995,10 @@ lodash.templatesettings@^3.0.0: lodash._reinterpolate "^3.0.0" lodash.escape "^3.0.0" +lodash@^4.17.10: + version "4.17.10" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" + lodash@^4.17.4, lodash@^4.17.5, lodash@^4.5.1: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" @@ -2812,6 +2832,12 @@ rxjs@^5.4.2, rxjs@^5.4.3, rxjs@^5.5.2: dependencies: symbol-observable "1.0.1" +rxjs@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.0.0.tgz#d647e029b5854617f994c82fe57a4c6747b352da" + dependencies: + tslib "^1.9.0" + safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" @@ -2897,19 +2923,6 @@ smartchok@1.0.14: smartq "^1.1.6" smartrx "^1.0.5" -smartcli@^2.0.9: - version "2.0.12" - resolved "https://registry.yarnpkg.com/smartcli/-/smartcli-2.0.12.tgz#e31008539813cb0bf1122a9281521a2f0f1e0224" - dependencies: - "@types/yargs" "^10.0.1" - beautylog "^6.1.10" - lik "^2.0.2" - rxjs "^5.4.3" - smartparam "1.0.2" - smartq "^1.1.6" - typings-global "^1.0.20" - yargs "^11.0.0" - smartcov@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/smartcov/-/smartcov-1.0.2.tgz#d81bed707fc6191a39a71384fb66ddd1f41dac1f" @@ -3577,6 +3590,10 @@ trim-newlines@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" +tslib@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" + tsn@^2.0.15: version "2.0.15" resolved "https://registry.yarnpkg.com/tsn/-/tsn-2.0.15.tgz#f1db8b59184922aa39ca03975642df351282dbcc" @@ -3610,10 +3627,14 @@ typed-function@0.10.7: version "0.10.7" resolved "https://registry.yarnpkg.com/typed-function/-/typed-function-0.10.7.tgz#f702af7d77a64b61abf86799ff2d74266ebc4477" -typescript@^2.1.5, typescript@^2.8.1: +typescript@^2.1.5: version "2.8.1" resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.1.tgz#6160e4f8f195d5ba81d4876f9c0cc1fbc0820624" +typescript@^2.8.3: + version "2.8.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.3.tgz#5d817f9b6f31bb871835f4edf0089f21abe6c170" + typings-global@^1.0.14, typings-global@^1.0.16, typings-global@^1.0.19, typings-global@^1.0.20, typings-global@^1.0.23: version "1.0.28" resolved "https://registry.yarnpkg.com/typings-global/-/typings-global-1.0.28.tgz#e28cc965476564cbc00e438739e0aa0735d323d4"