switch to seperate build/test commands to inrpove speed

This commit is contained in:
Philipp Kunz 2018-05-03 12:35:41 +02:00
parent df87337f4d
commit 34066d8a13
12 changed files with 93 additions and 47 deletions

View File

@ -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<INpmtsConfig>;

View File

@ -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;

20
dist/npmts.cli.js vendored
View File

@ -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;
});

View File

@ -22,5 +22,5 @@ export interface INpmtsConfig {
coverageResult?: number;
};
}
export declare let run: (argvArg: any) => Promise<{}>;
export declare let run: (argvArg: any) => Promise<INpmtsConfig>;
export declare let configPromise: Promise<INpmtsConfig>;

View File

@ -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';

View File

@ -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;

View File

@ -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"
}
}

View File

@ -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<INpmtsConfig>();
let config = configArg;

View File

@ -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;
};

View File

@ -32,7 +32,7 @@ export interface INpmtsConfig {
}
export let run = function(argvArg) {
let done = smartq.defer();
let done = smartq.defer<INpmtsConfig>();
let defaultConfig: INpmtsConfig = {
argv: undefined,
coverageTreshold: 70,

View File

@ -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';

View File

@ -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"