Merge branch 'master' into 'master'

introduce a merge option

See merge request !5
This commit is contained in:
Phil Kunz 2017-06-15 23:42:52 +00:00
commit 2bd187b704
5 changed files with 64 additions and 28 deletions

View File

@ -110,11 +110,20 @@ let checkNodeVersion = (configArg) => {
exports.run = (configArg) => {
let done = q.defer();
plugins.beautylog.ora.text('Check Module: ...');
// check cli
if (configArg.argv.nocheck) {
configArg.checkDependencies = false;
}
if (configArg.checkDependencies) {
checkProjectTypings(configArg)
.then(checkDependencies)
.then(checkDevDependencies)
.then(checkNodeVersion)
.then(done.resolve)
.catch((err) => { console.log(err); });
}
else {
done.resolve(configArg);
}
return done.promise;
};

View File

@ -1,7 +1,14 @@
export declare type npmtsMode = 'default' | 'custom';
/**
* specifies the different modes available
* default -> uses default options no matterm what
* merge -> uses merged default + custom options
* custom -> only uses specified options
*/
export declare type npmtsMode = 'default' | 'custom' | 'merge';
export interface INpmtsConfig {
argv: any;
coverageTreshold: number;
checkDependencies: boolean;
mode: npmtsMode;
test: boolean;
testTs: any;

View File

@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./npmts.plugins");
const paths = require("./npmts.paths");
const q = require("smartq");
;
exports.run = function (argvArg) {
let done = q.defer();
let defaultConfig = {
argv: undefined,
coverageTreshold: 70,
checkDependencies: true,
mode: 'default',
test: true,
testTs: {},
@ -27,16 +27,17 @@ exports.run = function (argvArg) {
switch (config.mode) {
case 'default':
case 'custom':
case 'merge':
plugins.beautylog.ok('mode is ' + config.mode);
done.resolve(config);
break;
default:
plugins.beautylog.error(`mode not recognised!`);
plugins.beautylog.error(`mode not recognised! Can be default or custom`);
process.exit(1);
}
;
// handle default mode
if (config.mode === 'default') {
if (config.mode === 'default' || config.mode === 'merge') {
config.ts = {
'./ts/**/*.ts': './dist/'
};

View File

@ -116,11 +116,21 @@ let checkNodeVersion = (configArg) => {
export let run = (configArg) => {
let done = q.defer()
plugins.beautylog.ora.text('Check Module: ...')
// check cli
if (configArg.argv.nocheck) {
configArg.checkDependencies = false
}
if (configArg.checkDependencies) {
checkProjectTypings(configArg)
.then(checkDependencies)
.then(checkDevDependencies)
.then(checkNodeVersion)
.then(done.resolve)
.catch((err) => { console.log(err) })
} else {
done.resolve(configArg)
}
return done.promise
}

View File

@ -3,28 +3,36 @@ import paths = require('./npmts.paths')
import * as q from 'smartq'
export type npmtsMode = 'default' | 'custom'
/**
* specifies the different modes available
* default -> uses default options no matterm what
* merge -> uses merged default + custom options
* custom -> only uses specified options
*/
export type npmtsMode = 'default' | 'custom' | 'merge'
export interface INpmtsConfig {
argv: any,
coverageTreshold: number,
mode: npmtsMode,
test: boolean,
testTs: any,
ts: any,
tsOptions: any,
argv: any
coverageTreshold: number
checkDependencies: boolean
mode: npmtsMode
test: boolean
testTs: any
ts: any
tsOptions: any
watch: boolean
runData: {
coverageLcovInfo?: string,
coverageLcovInfo?: string
coverageResult?: number
}
};
}
export let run = function (argvArg) {
let done = q.defer()
let defaultConfig: INpmtsConfig = {
argv: undefined,
coverageTreshold: 70,
checkDependencies: true,
mode: 'default',
test: true,
testTs: {},
@ -50,16 +58,17 @@ export let run = function (argvArg) {
switch (config.mode) {
case 'default':
case 'custom':
case 'merge':
plugins.beautylog.ok('mode is ' + config.mode)
done.resolve(config)
break
default:
plugins.beautylog.error(`mode not recognised!`)
plugins.beautylog.error(`mode not recognised! Can be default or custom`)
process.exit(1)
};
// handle default mode
if (config.mode === 'default') {
if (config.mode === 'default' || config.mode === 'merge') {
config.ts = {
'./ts/**/*.ts': './dist/'
}