2016-03-12 09:21:16 +00:00
|
|
|
"use strict";
|
2016-05-25 03:23:48 +00:00
|
|
|
require("typings-global");
|
2016-02-19 23:53:23 +00:00
|
|
|
var plugins = require("./npmts.plugins");
|
2016-08-19 07:46:36 +00:00
|
|
|
var paths = require("./npmts.paths");
|
2016-05-17 00:32:40 +00:00
|
|
|
var npmts_promisechain_1 = require("./npmts.promisechain");
|
2016-08-19 07:46:36 +00:00
|
|
|
;
|
|
|
|
exports.run = function (argvArg) {
|
2016-02-22 21:22:39 +00:00
|
|
|
var done = plugins.Q.defer();
|
2016-08-19 07:46:36 +00:00
|
|
|
var defaultConfig = {
|
|
|
|
argv: undefined,
|
|
|
|
coverageTreshold: 70,
|
|
|
|
docs: true,
|
|
|
|
mode: "default",
|
|
|
|
test: true,
|
|
|
|
testTs: {},
|
|
|
|
ts: {},
|
|
|
|
tsOptions: {}
|
|
|
|
};
|
|
|
|
// mix with configfile
|
|
|
|
npmts_promisechain_1.npmtsOra.text("looking for npmextra.json");
|
|
|
|
var config = plugins.npmextra.dataFor({
|
|
|
|
toolName: "npmts",
|
|
|
|
defaultSettings: defaultConfig,
|
|
|
|
cwd: paths.cwd
|
|
|
|
});
|
2016-08-19 09:16:13 +00:00
|
|
|
// add argv
|
|
|
|
config.argv = argvArg;
|
2016-08-19 07:46:36 +00:00
|
|
|
// check mode
|
|
|
|
switch (config.mode) {
|
|
|
|
case "default":
|
|
|
|
case "custom":
|
|
|
|
plugins.beautylog.ok("mode is " + config.mode);
|
|
|
|
done.resolve(config);
|
|
|
|
break;
|
|
|
|
default:
|
2016-08-19 09:16:13 +00:00
|
|
|
plugins.beautylog.error("mode not recognised!");
|
2016-08-19 07:46:36 +00:00
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
;
|
2016-03-23 13:12:58 +00:00
|
|
|
//handle default mode
|
2016-02-19 23:53:23 +00:00
|
|
|
if (config.mode == "default") {
|
|
|
|
config.ts = (_a = {},
|
|
|
|
_a["./ts/**/*.ts"] = "./dist/",
|
|
|
|
_a
|
|
|
|
);
|
2016-06-07 06:49:22 +00:00
|
|
|
config.testTs = (_b = {},
|
|
|
|
_b["./test/test.ts"] = "./test/",
|
|
|
|
_b
|
|
|
|
);
|
2016-02-19 23:53:23 +00:00
|
|
|
}
|
2016-08-19 07:46:36 +00:00
|
|
|
;
|
|
|
|
// mix with commandline
|
|
|
|
if (config.argv.notest) {
|
|
|
|
config.test = false;
|
|
|
|
}
|
|
|
|
;
|
|
|
|
if (config.argv.nodocs) {
|
|
|
|
config.docs = false;
|
|
|
|
}
|
|
|
|
;
|
2016-04-01 23:20:52 +00:00
|
|
|
plugins.beautylog.ok("build options are ready!");
|
2016-03-23 13:12:58 +00:00
|
|
|
done.resolve(config);
|
2016-02-19 23:53:23 +00:00
|
|
|
return done.promise;
|
2016-06-07 06:49:22 +00:00
|
|
|
var _a, _b;
|
2016-02-19 23:53:23 +00:00
|
|
|
};
|