Compare commits

...

4 Commits

Author SHA1 Message Date
def19f76e9 7.1.3 2017-06-16 16:08:41 +02:00
455c89d68d add coverage option 2017-06-16 16:08:36 +02:00
2bd187b704 Merge branch 'master' into 'master'
introduce a merge option

See merge request !5
2017-06-15 23:42:52 +00:00
29dff4c0e3 introduce a merge option 2017-06-15 23:42:48 +00:00
8 changed files with 98 additions and 47 deletions

View File

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

18
dist/mod02/index.js vendored
View File

@ -109,11 +109,19 @@ exports.run = function (configArg) {
plugins.beautylog.ora.text('now starting tests'); plugins.beautylog.ora.text('now starting tests');
plugins.beautylog.ora.end(); plugins.beautylog.ora.end();
plugins.beautylog.log('ready for tapbuffer:'); plugins.beautylog.log('ready for tapbuffer:');
tap(config) if (configArg.coverage) {
.then(handleCoverageData) tap(config)
.then(() => { .then(handleCoverageData)
done.resolve(config); .then(() => {
}).catch(err => { console.log(err); }); done.resolve(config);
}).catch(err => { console.log(err); });
}
else {
tap(config)
.then(() => {
done.resolve(config);
}).catch(err => { console.log(err); });
}
} }
else { else {
plugins.beautylog.ora.end(); plugins.beautylog.ora.end();

View File

@ -1,7 +1,15 @@
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 { export interface INpmtsConfig {
argv: any; argv: any;
coverage: boolean;
coverageTreshold: number; coverageTreshold: number;
checkDependencies: boolean;
mode: npmtsMode; mode: npmtsMode;
test: boolean; test: boolean;
testTs: any; testTs: any;

12
dist/npmts.config.js vendored
View File

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

View File

@ -1,6 +1,6 @@
{ {
"name": "npmts", "name": "npmts",
"version": "7.1.2", "version": "7.1.3",
"description": "Write npm modules with TypeScript without hassle. TypeScript ready. Fully ES6.", "description": "Write npm modules with TypeScript without hassle. TypeScript ready. Fully ES6.",
"main": "dist/index.js", "main": "dist/index.js",
"bin": { "bin": {

View File

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

View File

@ -114,12 +114,19 @@ export let run = function (configArg: INpmtsConfig) {
plugins.beautylog.ora.text('now starting tests') plugins.beautylog.ora.text('now starting tests')
plugins.beautylog.ora.end() plugins.beautylog.ora.end()
plugins.beautylog.log('ready for tapbuffer:') plugins.beautylog.log('ready for tapbuffer:')
if (configArg.coverage) {
tap(config)
.then(handleCoverageData)
.then(() => {
done.resolve(config)
}).catch(err => { console.log(err) })
} else {
tap(config)
.then(() => {
done.resolve(config)
}).catch(err => { console.log(err) })
}
tap(config)
.then(handleCoverageData)
.then(() => {
done.resolve(config)
}).catch(err => { console.log(err) })
} else { } else {
plugins.beautylog.ora.end() plugins.beautylog.ora.end()
done.resolve(config) done.resolve(config)

View File

@ -3,28 +3,38 @@ import paths = require('./npmts.paths')
import * as q from 'smartq' 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 { export interface INpmtsConfig {
argv: any, argv: any
coverageTreshold: number, coverage: boolean
mode: npmtsMode, coverageTreshold: number
test: boolean, checkDependencies: boolean
testTs: any, mode: npmtsMode
ts: any, test: boolean
tsOptions: any, testTs: any
ts: any
tsOptions: any
watch: boolean watch: boolean
runData: { runData: {
coverageLcovInfo?: string, coverageLcovInfo?: string
coverageResult?: number coverageResult?: number
} }
}; }
export let run = function (argvArg) { export let run = function (argvArg) {
let done = q.defer() let done = q.defer()
let defaultConfig: INpmtsConfig = { let defaultConfig: INpmtsConfig = {
argv: undefined, argv: undefined,
coverage: true,
coverageTreshold: 70, coverageTreshold: 70,
checkDependencies: true,
mode: 'default', mode: 'default',
test: true, test: true,
testTs: {}, testTs: {},
@ -50,31 +60,32 @@ export let run = function (argvArg) {
switch (config.mode) { switch (config.mode) {
case 'default': case 'default':
case 'custom': case 'custom':
case 'merge':
plugins.beautylog.ok('mode is ' + config.mode) plugins.beautylog.ok('mode is ' + config.mode)
done.resolve(config) done.resolve(config)
break break
default: default:
plugins.beautylog.error(`mode not recognised!`) plugins.beautylog.error(`mode not recognised! Can be default or custom`)
process.exit(1) process.exit(1)
}; }
// handle default mode // handle default mode
if (config.mode === 'default') { if (config.mode === 'default' || config.mode === 'merge') {
config.ts = { config.ts = {
'./ts/**/*.ts': './dist/' './ts/**/*.ts': './dist/'
} }
config.testTs = { config.testTs = {
'./test/**/*.ts': './test/' './test/**/*.ts': './test/'
} }
}; }
// mix with commandline // mix with commandline
if (config.argv.notest) { if (config.argv.notest) {
config.test = false config.test = false
}; }
if (config.argv.watch) { if (config.argv.watch) {
config.watch = true config.watch = true
}; }
plugins.beautylog.ok('build options are ready!') plugins.beautylog.ok('build options are ready!')
done.resolve(config) done.resolve(config)