now handles multiple typings recursivly

This commit is contained in:
Philipp Kunz 2016-02-06 18:56:42 +01:00
parent 4b2c0fe461
commit 0dc307f082
7 changed files with 46 additions and 14 deletions

2
index.d.ts vendored
View File

@ -9,6 +9,7 @@ declare module NpmtsPlugins {
sequence: any;
typescript: any;
};
mathjs: any;
mergeStream: any;
mocha: any;
path: any;
@ -46,6 +47,7 @@ declare var plugins: {
sequence: any;
typescript: any;
};
mathjs: any;
mergeStream: any;
mocha: any;
path: any;

View File

@ -13,6 +13,7 @@ var NpmtsPlugins;
sequence: require("gulp-sequence"),
typescript: require("gulp-typescript")
},
mathjs: require("mathjs"),
mergeStream: require("merge2"),
mocha: require("mocha"),
path: require("path"),
@ -84,19 +85,28 @@ var NpmtsCustom;
* ----------- first install typings ---------------
* ----------------------------------------------- */
var typingsDone = plugins.q.defer();
var checkTypingsDone = function (indexArg, compareArray) {
if ((indexArg + 1) == compareArray.length) {
var typingsCounter = 0;
var typingsCounterAdvance = function () {
typingsCounter++;
if (typeof config.typings[typingsCounter] != "undefined") {
installTypings();
}
else {
plugins.beautylog.success("custom typings installed successfully");
typingsDone.resolve();
}
};
for (var key in config.typings) {
plugins.beautylog.log("now installing " + "typings.json".yellow + " from " + config.typings[key].blue);
plugins.typings.install({ production: false, cwd: plugins.path.join(paths.cwd, config.typings[key]) })
var installTypings = function () {
plugins.beautylog.log("now installing " + "typings.json".yellow + " from " + config.typings[typingsCounter].blue);
plugins.typings.install({ production: false, cwd: plugins.path.join(paths.cwd, config.typings[typingsCounter]) })
.then(function () {
checkTypingsDone(key, config.typings);
typingsCounterAdvance();
}, function () {
plugins.beautylog.error("something went wrong: Check if path is correct: " + config.typings[typingsCounter].blue);
typingsCounterAdvance();
});
}
};
installTypings();
/* -------------------------------------------------
* ----------- second compile TS -------------------
* ----------------------------------------------- */

View File

@ -33,6 +33,7 @@
"gulp-sequence": "^0.4.4",
"gulp-typescript": "2.10.0",
"gulp-typings": "0.0.0",
"mathjs": "^2.7.0",
"merge2": "1.0.1",
"mocha": "^2.4.5",
"q": "^1.4.1",

View File

@ -4,6 +4,9 @@
"./customdir/*.ts":"./"
},
"typings":[
"./ts",
"./subts1/",
"./subts2/",
"./customdir"
]
}

View File

@ -0,0 +1,7 @@
{
"ambientDependencies": {
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777",
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d",
"vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777"
}
}

View File

@ -10,19 +10,27 @@ module NpmtsCustom {
* ----------- first install typings ---------------
* ----------------------------------------------- */
var typingsDone = plugins.q.defer();
var checkTypingsDone = function(indexArg:number,compareArray){
if((indexArg + 1) == compareArray.length){
var typingsCounter:number = 0;
var typingsCounterAdvance = function(){
typingsCounter++;
if(typeof config.typings[typingsCounter] != "undefined"){
installTypings();
} else {
plugins.beautylog.success("custom typings installed successfully");
typingsDone.resolve();
}
};
for (var key in config.typings) {
plugins.beautylog.log("now installing " + "typings.json".yellow + " from " + config.typings[key].blue);
plugins.typings.install({production: false, cwd: plugins.path.join(paths.cwd,config.typings[key])})
var installTypings = function() {
plugins.beautylog.log("now installing " + "typings.json".yellow + " from " + config.typings[typingsCounter].blue);
plugins.typings.install({production: false, cwd: plugins.path.join(paths.cwd,config.typings[typingsCounter])})
.then(function(){
checkTypingsDone(key,config.typings);
typingsCounterAdvance();
},function(){
plugins.beautylog.error("something went wrong: Check if path is correct: " + config.typings[typingsCounter].blue);
typingsCounterAdvance();
});
}
};
installTypings();
/* -------------------------------------------------
* ----------- second compile TS -------------------
* ----------------------------------------------- */

View File

@ -11,6 +11,7 @@ module NpmtsPlugins {
typescript: require("gulp-typescript")
},
mathjs: require("mathjs"),
mergeStream: require("merge2"),
mocha: require("mocha"),
path: require("path"),