update options
This commit is contained in:
@ -1,36 +0,0 @@
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
import {npmtsOra} from "./npmts.promisechain";
|
||||
export var run = function(argvArg){
|
||||
let done = plugins.Q.defer();
|
||||
npmtsOra.text("looking for npmextra.json");
|
||||
let defaultConfig = {
|
||||
mode: "default",
|
||||
notest:false,
|
||||
nodocs:false
|
||||
};
|
||||
if(argvArg.notest){
|
||||
defaultConfig.notest = true;
|
||||
};
|
||||
if(argvArg.nodocs){
|
||||
defaultConfig.nodocs = true;
|
||||
};
|
||||
let config = plugins.npmextra.dataFor({
|
||||
toolName:"npmts",
|
||||
defaultSettings:defaultConfig,
|
||||
cwd:paths.cwd
|
||||
});
|
||||
switch (config.mode){
|
||||
case "default":
|
||||
case "custom":
|
||||
plugins.beautylog.ok("mode is " + config.mode.yellow);
|
||||
done.resolve(config);
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
||||
process.exit(1);
|
||||
};
|
||||
done.resolve(config);
|
||||
return done.promise;
|
||||
};
|
@ -1,36 +1,76 @@
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
import {npmtsOra} from "./npmts.promisechain";
|
||||
|
||||
export var run = function(configArg){
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
export type npmtsMode = "default" | "custom"
|
||||
|
||||
npmtsOra.text("now determining build options...");
|
||||
export interface npmtsConfig {
|
||||
argv:any,
|
||||
coverageTreshold:number,
|
||||
docs:boolean,
|
||||
mode: npmtsMode,
|
||||
test:boolean,
|
||||
testTs:any,
|
||||
ts:any,
|
||||
tsOptions:any
|
||||
|
||||
};
|
||||
|
||||
|
||||
export var run = function(argvArg){
|
||||
let done = plugins.Q.defer();
|
||||
let defaultConfig:npmtsConfig = {
|
||||
argv:undefined,
|
||||
coverageTreshold: 70,
|
||||
docs: true,
|
||||
mode:"default",
|
||||
test:true,
|
||||
testTs:{},
|
||||
ts:{},
|
||||
tsOptions: {}
|
||||
};
|
||||
|
||||
|
||||
// mix with configfile
|
||||
npmtsOra.text("looking for npmextra.json");
|
||||
let config:npmtsConfig = plugins.npmextra.dataFor({
|
||||
toolName:"npmts",
|
||||
defaultSettings:defaultConfig,
|
||||
cwd:paths.cwd
|
||||
});
|
||||
|
||||
// check mode
|
||||
switch (config.mode){
|
||||
case "default":
|
||||
case "custom":
|
||||
plugins.beautylog.ok("mode is " + config.mode);
|
||||
done.resolve(config);
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.error("mode " + config.mode + " not recognised!".red);
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
//handle default mode
|
||||
if (config.mode == "default"){
|
||||
config.typings = [
|
||||
"./ts/typings.json"
|
||||
];
|
||||
config.ts = {
|
||||
["./ts/**/*.ts"]: "./dist/"
|
||||
};
|
||||
config.testTs = {
|
||||
["./test/test.ts"]: "./test/"
|
||||
};
|
||||
config.test = ["./index.js"];
|
||||
}
|
||||
|
||||
//check if config.tsOptions is available
|
||||
config.tsOptions ? void(0) : config.tsOptions = {};
|
||||
};
|
||||
|
||||
|
||||
|
||||
config.coverageTreshold ? void(0) : config.coverageTreshold = 70;
|
||||
// mix with commandline
|
||||
if(config.argv.notest){
|
||||
config.test = false;
|
||||
};
|
||||
if(config.argv.nodocs){
|
||||
config.docs = false;
|
||||
};
|
||||
|
||||
// handle docs
|
||||
config.docs ? void(0) : config.docs = {};
|
||||
|
||||
plugins.beautylog.ok("build options are ready!");
|
||||
done.resolve(config);
|
||||
|
@ -8,7 +8,6 @@ import NpmtsAssets = require("./npmts.assets");
|
||||
import NpmtsCheck = require("./npmts.check");
|
||||
import NpmtsClean = require("./npmts.clean");
|
||||
import NpmtsCompile = require("./npmts.compile");
|
||||
import NpmtsConfigFile = require("./npmts.configfile");
|
||||
import NpmtsTypeDoc = require("./npmts.typedoc");
|
||||
import NpmtsOptions = require("./npmts.options");
|
||||
import NpmtsTests = require("./npmts.tests");
|
||||
@ -16,8 +15,7 @@ import NpmtsTests = require("./npmts.tests");
|
||||
export let promisechain = function(argvArg){
|
||||
let done = plugins.Q.defer();
|
||||
npmtsOra.start();
|
||||
NpmtsConfigFile.run(argvArg)
|
||||
.then(NpmtsOptions.run)
|
||||
NpmtsOptions.run(argvArg)
|
||||
.then(NpmtsClean.run)
|
||||
.then(NpmtsCheck.run)
|
||||
.then(NpmtsCompile.run)
|
||||
|
@ -66,7 +66,7 @@ let coverage = function(configArg){
|
||||
export let run = function(configArg) {
|
||||
let done = plugins.Q.defer();
|
||||
let config = configArg;
|
||||
if(config.notest != true){
|
||||
if(config.test === true){
|
||||
npmtsOra.text("now starting tests");
|
||||
plugins.beautylog.log(
|
||||
"-------------------------------------------------------\n" +
|
||||
|
@ -32,13 +32,13 @@ let genTypeDoc = function (configArg) {
|
||||
|
||||
export let run = function (configArg) {
|
||||
let done = plugins.Q.defer();
|
||||
if (configArg.nodocs) {
|
||||
done.resolve(configArg);
|
||||
} else {
|
||||
if (configArg.docs) {
|
||||
genTypeDoc(configArg)
|
||||
.then(() => {
|
||||
done.resolve(configArg);
|
||||
});
|
||||
} else {
|
||||
done.resolve(configArg);
|
||||
};
|
||||
return done.promise;
|
||||
};
|
Reference in New Issue
Block a user