tscoverage/ts/npmts.options.ts

61 lines
1.9 KiB
TypeScript
Raw Normal View History

2016-02-20 00:53:23 +01:00
/// <reference path="./typings/main.d.ts" />
import plugins = require("./npmts.plugins");
2016-05-17 02:32:40 +02:00
import {npmtsOra} from "./npmts.promisechain";
export let isCi = function(){
return plugins.smartci.check.isCi();
};
export let isRelease = function():boolean {
2016-03-23 15:47:28 +01:00
return plugins.smartci.check.isCi()
&& plugins.smartci.check.isTaggedCommit();
};
export let doPublish = function():boolean {
return isRelease()
2016-03-23 15:55:07 +01:00
&& plugins.smartci.get.subJobNumber() == 1;
};
2016-02-20 00:53:23 +01:00
export var run = function(configArg){
2016-02-22 22:22:39 +01:00
var done = plugins.Q.defer();
2016-02-20 00:53:23 +01:00
var config = configArg;
2016-05-17 02:32:40 +02:00
npmtsOra.text("now determining build options...");
//handle default mode
2016-02-20 00:53:23 +01:00
if (config.mode == "default"){
config.typings = [
2016-03-12 10:21:16 +01:00
"./ts/typings.json"
2016-02-20 00:53:23 +01:00
];
config.ts = {
["./ts/**/*.ts"]: "./dist/",
["./test/test.ts"]: "./test/"
};
config.test = ["./index.js"];
}
//check if config.tsOptions is available
config.tsOptions ? void(0) : config.tsOptions = {};
// handle state of current build
2016-03-23 15:47:28 +01:00
isRelease() ? plugins.beautylog.info("All right: This is a RELEASE build!")
2016-03-23 15:55:07 +01:00
: plugins.beautylog.info("NOT A RELEASE build!");
isRelease() && doPublish() ? plugins.beautylog.info("All right: This is the first subBuild, so this one publishes COVERAGE + DOCS when tests succeed!")
2016-03-23 15:55:07 +01:00
: plugins.beautylog.info("We are not publishing anything!");
// handle coveralls
2016-04-02 19:09:11 +02:00
config.codecov ? void(0) : config.codecov = true;
isCi() ? void(0) : config.codecov = false;
2016-03-23 15:47:28 +01:00
2016-03-30 01:32:41 +02:00
config.coverageTreshold ? void(0) : config.coverageTreshold = 70;
2016-03-23 15:47:28 +01:00
// handle docs
config.docs ? void(0) : config.docs = {};
config.docs.publish ? void(0) : config.docs.publish = false;
doPublish() ? void(0) : config.docs.publish = false;
2016-04-02 01:20:52 +02:00
plugins.beautylog.ok("build options are ready!");
done.resolve(config);
2016-02-20 00:53:23 +01:00
return done.promise;
};