now using gulp-typings
This commit is contained in:
parent
8efa67a4ff
commit
9f74fab2b2
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,10 +1,10 @@
|
|||||||
.idea/
|
.idea/
|
||||||
.c9/
|
.c9/
|
||||||
node_modules/
|
node_modules/
|
||||||
test/**/node_modules/
|
test/assets/**/node_modules/
|
||||||
test/assets/docs/
|
test/assets/**/docs/
|
||||||
test/**/typings/
|
test/assets/**/typings/
|
||||||
test/**/coverage/
|
test/assets/**/coverage/
|
||||||
ts/*.js
|
ts/*.js
|
||||||
ts/*.js.map
|
ts/*.js.map
|
||||||
ts/typings/
|
ts/typings/
|
||||||
|
1
dist/index.js
vendored
1
dist/index.js
vendored
@ -1,3 +1,4 @@
|
|||||||
|
"use strict";
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
console.log("**** starting NPMTS ****");
|
console.log("**** starting NPMTS ****");
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
|
121
dist/npmts.compile.js
vendored
121
dist/npmts.compile.js
vendored
@ -1,89 +1,62 @@
|
|||||||
|
"use strict";
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
var paths = require("./npmts.paths");
|
var paths = require("./npmts.paths");
|
||||||
exports.run = function (configArg) {
|
exports.run = function (configArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
var config = configArg;
|
var config = configArg;
|
||||||
plugins.beautylog.log("now running custom tasks");
|
plugins.beautylog.log("now compiling " + "TypeScript".yellow);
|
||||||
var moduleStream = plugins.merge2({ end: false });
|
var moduleStream = plugins.merge2({ end: false });
|
||||||
/* -------------------------------------------------
|
/* -------------------------------------------------
|
||||||
* ----------- first install typings ---------------
|
* ----------- compile TypeScript --------------------------
|
||||||
* ----------------------------------------------- */
|
* ----------------------------------------------- */
|
||||||
var typingsDone = plugins.Q.defer();
|
for (var key in config.ts) {
|
||||||
var typingsCounter = 0;
|
var outputPathIsDir;
|
||||||
var typingsCounterAdvance = function () {
|
try {
|
||||||
typingsCounter++;
|
if (plugins.fs.statSync(plugins.path.join(paths.cwd, config.ts[key])).isDirectory()) {
|
||||||
if (typeof config.typings[typingsCounter] != "undefined") {
|
outputPathIsDir = true;
|
||||||
installTypings();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
plugins.beautylog.success("custom typings installed successfully");
|
|
||||||
typingsDone.resolve();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
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 () {
|
|
||||||
typingsCounterAdvance();
|
|
||||||
}, function () {
|
|
||||||
plugins.beautylog.error("something went wrong: Check if path is correct: " + config.typings[typingsCounter].blue);
|
|
||||||
typingsCounterAdvance();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
installTypings();
|
|
||||||
/* -------------------------------------------------
|
|
||||||
* ----------- second compile TS -------------------
|
|
||||||
* ----------------------------------------------- */
|
|
||||||
typingsDone.promise.then(function () {
|
|
||||||
for (var key in config.ts) {
|
|
||||||
plugins.beautylog.log("now compiling" + key.blue);
|
|
||||||
var outputPathIsDir;
|
|
||||||
try {
|
|
||||||
if (plugins.fs.statSync(plugins.path.join(paths.cwd, config.ts[key])).isDirectory()) {
|
|
||||||
outputPathIsDir = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (err) {
|
|
||||||
outputPathIsDir = false;
|
|
||||||
}
|
|
||||||
//do some evaluation of the environment
|
|
||||||
var outputNameSpecified = (!outputPathIsDir
|
|
||||||
&& (plugins.path.extname(config.ts[key]) == ".js"));
|
|
||||||
var outputName = (function () {
|
|
||||||
if (outputNameSpecified) {
|
|
||||||
return plugins.path.basename(config.ts[key]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
var outputDir = (function () {
|
|
||||||
if (outputNameSpecified) {
|
|
||||||
return plugins.path.dirname(plugins.path.join(paths.cwd, config.ts[key]));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return plugins.path.join(paths.cwd, config.ts[key]);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, key), "!**/typings/**"])
|
|
||||||
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
|
||||||
.pipe(plugins.g.typescript({
|
|
||||||
out: outputName,
|
|
||||||
target: "ES5",
|
|
||||||
module: "commonjs"
|
|
||||||
}))
|
|
||||||
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
|
||||||
.pipe(plugins.gulp.dest(outputDir));
|
|
||||||
moduleStream.add(stream);
|
|
||||||
}
|
}
|
||||||
moduleStream.on("queueDrain", function () {
|
catch (err) {
|
||||||
plugins.beautylog.success("custom TypeScript installed successfully");
|
outputPathIsDir = false;
|
||||||
moduleStream.on("finish", function () {
|
}
|
||||||
done.resolve(config);
|
//do some evaluation of the environment
|
||||||
});
|
var outputNameSpecified = (!outputPathIsDir
|
||||||
moduleStream.end();
|
&& (plugins.path.extname(config.ts[key]) == ".js"));
|
||||||
|
var outputName = (function () {
|
||||||
|
if (outputNameSpecified) {
|
||||||
|
return plugins.path.basename(config.ts[key]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
var outputDir = (function () {
|
||||||
|
if (outputNameSpecified) {
|
||||||
|
return plugins.path.dirname(plugins.path.join(paths.cwd, config.ts[key]));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return plugins.path.join(paths.cwd, config.ts[key]);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, key), "!**/typings/**"])
|
||||||
|
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
||||||
|
.pipe(plugins.g.typescript({
|
||||||
|
out: outputName,
|
||||||
|
target: "ES5",
|
||||||
|
module: "commonjs"
|
||||||
|
}))
|
||||||
|
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
||||||
|
.pipe(plugins.gulp.dest(outputDir));
|
||||||
|
moduleStream.add(stream);
|
||||||
|
}
|
||||||
|
moduleStream.on("queueDrain", function () {
|
||||||
|
plugins.beautylog.ok("TypeScript is compiled!");
|
||||||
|
moduleStream.on("finish", function () {
|
||||||
|
done.resolve(config);
|
||||||
});
|
});
|
||||||
|
moduleStream.end();
|
||||||
});
|
});
|
||||||
|
/*==================== END TYPESCRIPT =====================*/
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
2
dist/npmts.configfile.js
vendored
2
dist/npmts.configfile.js
vendored
@ -1,3 +1,4 @@
|
|||||||
|
"use strict";
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
var paths = require("./npmts.paths");
|
var paths = require("./npmts.paths");
|
||||||
@ -16,6 +17,7 @@ exports.run = function () {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
||||||
|
process.exit(1);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
20
dist/npmts.install.js
vendored
Normal file
20
dist/npmts.install.js
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
"use strict";
|
||||||
|
/// <reference path="./typings/main.d.ts" />
|
||||||
|
var plugins = require("./npmts.plugins");
|
||||||
|
var paths = require("./npmts.paths");
|
||||||
|
exports.run = function (configArg) {
|
||||||
|
var config = configArg;
|
||||||
|
var done = plugins.Q.defer();
|
||||||
|
/* -------------------------------------------------
|
||||||
|
* ----------- install typings ---------------
|
||||||
|
* ----------------------------------------------- */
|
||||||
|
plugins.beautylog.log("now installing " + "typings".yellow);
|
||||||
|
var absoluteTypingsArray = plugins.smartpath.absolute(config.typings, paths.cwd);
|
||||||
|
plugins.gulp.src(absoluteTypingsArray)
|
||||||
|
.pipe(plugins.g.typings())
|
||||||
|
.pipe(plugins.g.gFunction(function () {
|
||||||
|
plugins.beautylog.ok("typings are installed!");
|
||||||
|
done.resolve(config);
|
||||||
|
}, "atEnd"));
|
||||||
|
return done.promise;
|
||||||
|
};
|
4
dist/npmts.jsdoc.js
vendored
4
dist/npmts.jsdoc.js
vendored
@ -1,3 +1,4 @@
|
|||||||
|
"use strict";
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
var paths = require("./npmts.paths");
|
var paths = require("./npmts.paths");
|
||||||
@ -13,6 +14,7 @@ var genJsdoc = function (configArg) {
|
|||||||
destination: paths.docsDir
|
destination: paths.docsDir
|
||||||
}
|
}
|
||||||
}, function () {
|
}, function () {
|
||||||
|
plugins.beautylog.ok("JsDoc has been generated!");
|
||||||
done.resolve(configArg);
|
done.resolve(configArg);
|
||||||
}));
|
}));
|
||||||
return done.promise;
|
return done.promise;
|
||||||
@ -42,7 +44,7 @@ var publishDocs = function (configArg) {
|
|||||||
plugins.beautylog.error('Error: Git failed');
|
plugins.beautylog.error('Error: Git failed');
|
||||||
plugins.shelljs.exit(1);
|
plugins.shelljs.exit(1);
|
||||||
}
|
}
|
||||||
plugins.beautylog.success("Docs have been deployed to GitHub");
|
plugins.beautylog.ok("JsDoc has been deployed to GitHub!");
|
||||||
done.resolve(configArg);
|
done.resolve(configArg);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
3
dist/npmts.options.js
vendored
3
dist/npmts.options.js
vendored
@ -1,3 +1,4 @@
|
|||||||
|
"use strict";
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
exports.run = function (configArg) {
|
exports.run = function (configArg) {
|
||||||
@ -8,7 +9,7 @@ exports.run = function (configArg) {
|
|||||||
}
|
}
|
||||||
if (config.mode == "default") {
|
if (config.mode == "default") {
|
||||||
config.typings = [
|
config.typings = [
|
||||||
"./ts/"
|
"./ts/typings.json"
|
||||||
];
|
];
|
||||||
config.ts = (_a = {},
|
config.ts = (_a = {},
|
||||||
_a["./ts/**/*.ts"] = "./dist/",
|
_a["./ts/**/*.ts"] = "./dist/",
|
||||||
|
1
dist/npmts.paths.js
vendored
1
dist/npmts.paths.js
vendored
@ -1,3 +1,4 @@
|
|||||||
|
"use strict";
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
var paths = {};
|
var paths = {};
|
||||||
|
6
dist/npmts.plugins.js
vendored
6
dist/npmts.plugins.js
vendored
@ -1,3 +1,4 @@
|
|||||||
|
"use strict";
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var plugins = {
|
var plugins = {
|
||||||
beautylog: require("beautylog"),
|
beautylog: require("beautylog"),
|
||||||
@ -10,7 +11,8 @@ var plugins = {
|
|||||||
jsdoc3: require("gulp-jsdoc3"),
|
jsdoc3: require("gulp-jsdoc3"),
|
||||||
mocha: require("gulp-mocha"),
|
mocha: require("gulp-mocha"),
|
||||||
sourcemaps: require("gulp-sourcemaps"),
|
sourcemaps: require("gulp-sourcemaps"),
|
||||||
typescript: require("gulp-typescript")
|
typescript: require("gulp-typescript"),
|
||||||
|
typings: require("gulp-typings")
|
||||||
},
|
},
|
||||||
merge2: require("merge2"),
|
merge2: require("merge2"),
|
||||||
projectinfo: require("projectinfo"),
|
projectinfo: require("projectinfo"),
|
||||||
@ -21,6 +23,6 @@ var plugins = {
|
|||||||
smartcli: require("smartcli"),
|
smartcli: require("smartcli"),
|
||||||
smartenv: require("smartenv"),
|
smartenv: require("smartenv"),
|
||||||
smartfile: require("smartfile"),
|
smartfile: require("smartfile"),
|
||||||
typings: require("typings")
|
smartpath: require("smartpath")
|
||||||
};
|
};
|
||||||
module.exports = plugins;
|
module.exports = plugins;
|
||||||
|
3
dist/npmts.promisechain.js
vendored
3
dist/npmts.promisechain.js
vendored
@ -1,6 +1,8 @@
|
|||||||
|
"use strict";
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var NpmtsConfigFile = require("./npmts.configfile");
|
var NpmtsConfigFile = require("./npmts.configfile");
|
||||||
var NpmtsOptions = require("./npmts.options");
|
var NpmtsOptions = require("./npmts.options");
|
||||||
|
var NpmtsInstall = require("./npmts.install");
|
||||||
var NpmtsCompile = require("./npmts.compile");
|
var NpmtsCompile = require("./npmts.compile");
|
||||||
var NpmtsJsdoc = require("./npmts.jsdoc");
|
var NpmtsJsdoc = require("./npmts.jsdoc");
|
||||||
var NpmtsTests = require("./npmts.tests");
|
var NpmtsTests = require("./npmts.tests");
|
||||||
@ -8,6 +10,7 @@ exports.run = function () {
|
|||||||
var promisechain;
|
var promisechain;
|
||||||
NpmtsConfigFile.run()
|
NpmtsConfigFile.run()
|
||||||
.then(NpmtsOptions.run)
|
.then(NpmtsOptions.run)
|
||||||
|
.then(NpmtsInstall.run)
|
||||||
.then(NpmtsCompile.run)
|
.then(NpmtsCompile.run)
|
||||||
.then(NpmtsJsdoc.run)
|
.then(NpmtsJsdoc.run)
|
||||||
.then(NpmtsTests.run);
|
.then(NpmtsTests.run);
|
||||||
|
8
dist/npmts.tests.js
vendored
8
dist/npmts.tests.js
vendored
@ -1,3 +1,4 @@
|
|||||||
|
"use strict";
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
var paths = require("./npmts.paths");
|
var paths = require("./npmts.paths");
|
||||||
@ -20,9 +21,13 @@ exports.run = function (configArg) {
|
|||||||
var coveralls = function () {
|
var coveralls = function () {
|
||||||
plugins.beautylog.log("now uploading coverage data to coveralls");
|
plugins.beautylog.log("now uploading coverage data to coveralls");
|
||||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "./coverage/lcov.info")])
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "./coverage/lcov.info")])
|
||||||
.pipe(plugins.g.coveralls());
|
.pipe(plugins.g.coveralls())
|
||||||
|
.pipe(plugins.g.gFunction(function () {
|
||||||
|
plugins.beautylog.ok("coverage data has beend uploaded Coveralls!");
|
||||||
|
}, "atEnd"));
|
||||||
return stream;
|
return stream;
|
||||||
};
|
};
|
||||||
|
plugins.beautylog.log("now starting tests");
|
||||||
istanbul().on("finish", function () {
|
istanbul().on("finish", function () {
|
||||||
mocha().on("finish", function () {
|
mocha().on("finish", function () {
|
||||||
if (plugins.smartenv.getEnv().isTravis && config.coveralls) {
|
if (plugins.smartenv.getEnv().isTravis && config.coveralls) {
|
||||||
@ -31,6 +36,7 @@ exports.run = function (configArg) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
plugins.beautylog.ok("Tests have passed!");
|
||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -36,17 +36,17 @@
|
|||||||
"gulp-jsdoc3": "^0.2.0",
|
"gulp-jsdoc3": "^0.2.0",
|
||||||
"gulp-mocha": "^2.2.0",
|
"gulp-mocha": "^2.2.0",
|
||||||
"gulp-sourcemaps": "^1.6.0",
|
"gulp-sourcemaps": "^1.6.0",
|
||||||
"gulp-typescript": "2.11.0",
|
"gulp-typescript": "2.12.1",
|
||||||
"gulp-typings": "1.1.0",
|
"gulp-typings": "1.1.0",
|
||||||
"merge2": "1.0.1",
|
"merge2": "1.0.1",
|
||||||
"projectinfo": "1.0.1",
|
"projectinfo": "1.0.1",
|
||||||
"q": "^1.4.1",
|
"q": "^1.4.1",
|
||||||
"shelljs": "^0.6.0",
|
"shelljs": "^0.6.0",
|
||||||
"smartcli": "0.0.11",
|
"smartcli": "0.0.11",
|
||||||
"smartenv": "1.1.0",
|
"smartenv": "1.2.0",
|
||||||
"smartfile": "0.0.11",
|
"smartfile": "0.0.11",
|
||||||
"source-map-support": "^0.4.0",
|
"smartpath": "2.1.0",
|
||||||
"typings": "^0.6.8"
|
"source-map-support": "^0.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp-typings": "^1.1.0"
|
"gulp-typings": "^1.1.0"
|
||||||
|
3
test/assets/custom.js
Normal file
3
test/assets/custom.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
var hello = "hello";
|
||||||
|
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1c3RvbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxJQUFJLEtBQUssR0FBRyxPQUFPLENBQUMiLCJmaWxlIjoiY3VzdG9tLmpzIiwic291cmNlc0NvbnRlbnQiOlsidmFyIGhlbGxvID0gXCJoZWxsb1wiOyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"mode":"default",
|
"mode":"custom",
|
||||||
"ts":{
|
"ts":{
|
||||||
"./customdir/*.ts":"./"
|
"./customdir/*.ts":"./"
|
||||||
},
|
},
|
||||||
"typings":[
|
"typings":[
|
||||||
"./ts",
|
"./ts/typings.json",
|
||||||
"./subts1/",
|
"./subts1/typings.json",
|
||||||
"./subts2/",
|
"./subts2/typings.json",
|
||||||
"./customdir"
|
"./customdir/typings.json"
|
||||||
],
|
],
|
||||||
"coveralls":true,
|
"coveralls":true,
|
||||||
"docs": {
|
"docs": {
|
||||||
|
3
test/assets/tsfile1.js
Normal file
3
test/assets/tsfile1.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
var something = "something";
|
||||||
|
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRzZmlsZTEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBSSxTQUFTLEdBQUcsV0FBVyxDQUFDIiwiZmlsZSI6InRzZmlsZTEuanMiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgc29tZXRoaW5nID0gXCJzb21ldGhpbmdcIjsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
@ -4,89 +4,66 @@ import paths = require("./npmts.paths");
|
|||||||
export var run = function(configArg){
|
export var run = function(configArg){
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
var config = configArg;
|
var config = configArg;
|
||||||
plugins.beautylog.log("now running custom tasks");
|
plugins.beautylog.log("now compiling " + "TypeScript".yellow);
|
||||||
var moduleStream = plugins.merge2({end: false});
|
var moduleStream = plugins.merge2({end: false});
|
||||||
/* -------------------------------------------------
|
|
||||||
* ----------- first install typings ---------------
|
|
||||||
* ----------------------------------------------- */
|
|
||||||
var typingsDone = plugins.Q.defer();
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
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(){
|
|
||||||
typingsCounterAdvance();
|
|
||||||
},function(){
|
|
||||||
plugins.beautylog.error("something went wrong: Check if path is correct: " + config.typings[typingsCounter].blue);
|
|
||||||
typingsCounterAdvance();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
installTypings();
|
|
||||||
/* -------------------------------------------------
|
|
||||||
* ----------- second compile TS -------------------
|
|
||||||
* ----------------------------------------------- */
|
|
||||||
typingsDone.promise.then(function(){
|
|
||||||
for (var key in config.ts) {
|
|
||||||
plugins.beautylog.log("now compiling" + key.blue);
|
|
||||||
var outputPathIsDir:boolean;
|
|
||||||
try {
|
|
||||||
if(plugins.fs.statSync(plugins.path.join(paths.cwd,config.ts[key])).isDirectory()){
|
|
||||||
outputPathIsDir = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(err) {
|
|
||||||
outputPathIsDir = false;
|
|
||||||
}
|
|
||||||
//do some evaluation of the environment
|
|
||||||
var outputNameSpecified:boolean = (
|
|
||||||
!outputPathIsDir
|
|
||||||
&& (plugins.path.extname(config.ts[key]) == ".js")
|
|
||||||
);
|
|
||||||
var outputName = (function(){
|
|
||||||
if(outputNameSpecified){
|
|
||||||
return plugins.path.basename(config.ts[key])
|
|
||||||
} else {
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
var outputDir = (function(){
|
|
||||||
if(outputNameSpecified){
|
|
||||||
return plugins.path.dirname(
|
|
||||||
plugins.path.join(paths.cwd,config.ts[key])
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
return plugins.path.join(paths.cwd,config.ts[key])
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,key),"!**/typings/**"])
|
/* -------------------------------------------------
|
||||||
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
* ----------- compile TypeScript --------------------------
|
||||||
.pipe(plugins.g.typescript({
|
* ----------------------------------------------- */
|
||||||
out: outputName,
|
for (var key in config.ts) {
|
||||||
target: "ES5",
|
var outputPathIsDir:boolean;
|
||||||
module: "commonjs"
|
try {
|
||||||
}))
|
if(plugins.fs.statSync(plugins.path.join(paths.cwd,config.ts[key])).isDirectory()){
|
||||||
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
outputPathIsDir = true;
|
||||||
//.pipe(plugins.g.header('#!/usr/bin/env node\n\n'))
|
}
|
||||||
.pipe(plugins.gulp.dest(outputDir));
|
|
||||||
moduleStream.add(stream);
|
|
||||||
}
|
}
|
||||||
moduleStream.on("queueDrain",function(){
|
catch(err) {
|
||||||
plugins.beautylog.success("custom TypeScript installed successfully");
|
outputPathIsDir = false;
|
||||||
moduleStream.on("finish",function(){
|
}
|
||||||
done.resolve(config);
|
//do some evaluation of the environment
|
||||||
});
|
var outputNameSpecified:boolean = (
|
||||||
moduleStream.end();
|
!outputPathIsDir
|
||||||
|
&& (plugins.path.extname(config.ts[key]) == ".js")
|
||||||
|
);
|
||||||
|
var outputName = (function(){
|
||||||
|
if(outputNameSpecified){
|
||||||
|
return plugins.path.basename(config.ts[key])
|
||||||
|
} else {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
var outputDir = (function(){
|
||||||
|
if(outputNameSpecified){
|
||||||
|
return plugins.path.dirname(
|
||||||
|
plugins.path.join(paths.cwd,config.ts[key])
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return plugins.path.join(paths.cwd,config.ts[key])
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,key),"!**/typings/**"])
|
||||||
|
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
||||||
|
.pipe(plugins.g.typescript({
|
||||||
|
out: outputName,
|
||||||
|
target: "ES5",
|
||||||
|
module: "commonjs"
|
||||||
|
}))
|
||||||
|
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
||||||
|
//.pipe(plugins.g.header('#!/usr/bin/env node\n\n'))
|
||||||
|
.pipe(plugins.gulp.dest(outputDir));
|
||||||
|
moduleStream.add(stream);
|
||||||
|
}
|
||||||
|
moduleStream.on("queueDrain",function(){
|
||||||
|
plugins.beautylog.ok("TypeScript is compiled!");
|
||||||
|
moduleStream.on("finish",function(){
|
||||||
|
done.resolve(config);
|
||||||
});
|
});
|
||||||
|
moduleStream.end();
|
||||||
});
|
});
|
||||||
|
/*==================== END TYPESCRIPT =====================*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
@ -16,6 +16,7 @@ export var run = function(){
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
||||||
|
process.exit(1);
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugins.beautylog.log("no config file found: so mode is " + "default".yellow);
|
plugins.beautylog.log("no config file found: so mode is " + "default".yellow);
|
||||||
|
19
ts/npmts.install.ts
Normal file
19
ts/npmts.install.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/// <reference path="./typings/main.d.ts" />
|
||||||
|
import plugins = require("./npmts.plugins");
|
||||||
|
import paths = require("./npmts.paths");
|
||||||
|
export var run = function(configArg){
|
||||||
|
var config = configArg;
|
||||||
|
var done = plugins.Q.defer();
|
||||||
|
/* -------------------------------------------------
|
||||||
|
* ----------- install typings ---------------
|
||||||
|
* ----------------------------------------------- */
|
||||||
|
plugins.beautylog.log("now installing " + "typings".yellow);
|
||||||
|
let absoluteTypingsArray = plugins.smartpath.absolute(config.typings,paths.cwd);
|
||||||
|
plugins.gulp.src(absoluteTypingsArray)
|
||||||
|
.pipe(plugins.g.typings())
|
||||||
|
.pipe(plugins.g.gFunction(function(){
|
||||||
|
plugins.beautylog.ok("typings are installed!");
|
||||||
|
done.resolve(config);
|
||||||
|
},"atEnd"));
|
||||||
|
return done.promise;
|
||||||
|
};
|
@ -14,6 +14,7 @@ var genJsdoc = function(configArg){
|
|||||||
destination: paths.docsDir
|
destination: paths.docsDir
|
||||||
}
|
}
|
||||||
}, function(){
|
}, function(){
|
||||||
|
plugins.beautylog.ok("JsDoc has been generated!");
|
||||||
done.resolve(configArg)
|
done.resolve(configArg)
|
||||||
}));
|
}));
|
||||||
return done.promise;
|
return done.promise;
|
||||||
@ -48,7 +49,7 @@ var publishDocs = function(configArg){
|
|||||||
plugins.beautylog.error('Error: Git failed');
|
plugins.beautylog.error('Error: Git failed');
|
||||||
plugins.shelljs.exit(1);
|
plugins.shelljs.exit(1);
|
||||||
}
|
}
|
||||||
plugins.beautylog.success("Docs have been deployed to GitHub");
|
plugins.beautylog.ok("JsDoc has been deployed to GitHub!");
|
||||||
done.resolve(configArg);
|
done.resolve(configArg);
|
||||||
} else {
|
} else {
|
||||||
done.resolve(configArg);
|
done.resolve(configArg);
|
||||||
|
@ -8,7 +8,7 @@ export var run = function(configArg){
|
|||||||
}
|
}
|
||||||
if (config.mode == "default"){
|
if (config.mode == "default"){
|
||||||
config.typings = [
|
config.typings = [
|
||||||
"./ts/"
|
"./ts/typings.json"
|
||||||
];
|
];
|
||||||
config.ts = {
|
config.ts = {
|
||||||
["./ts/**/*.ts"]: "./dist/",
|
["./ts/**/*.ts"]: "./dist/",
|
||||||
|
@ -10,7 +10,8 @@ var plugins = {
|
|||||||
jsdoc3: require("gulp-jsdoc3"),
|
jsdoc3: require("gulp-jsdoc3"),
|
||||||
mocha: require("gulp-mocha"),
|
mocha: require("gulp-mocha"),
|
||||||
sourcemaps: require("gulp-sourcemaps"),
|
sourcemaps: require("gulp-sourcemaps"),
|
||||||
typescript: require("gulp-typescript")
|
typescript: require("gulp-typescript"),
|
||||||
|
typings: require("gulp-typings")
|
||||||
|
|
||||||
},
|
},
|
||||||
merge2: require("merge2"),
|
merge2: require("merge2"),
|
||||||
@ -22,6 +23,6 @@ var plugins = {
|
|||||||
smartcli: require("smartcli"),
|
smartcli: require("smartcli"),
|
||||||
smartenv: require("smartenv"),
|
smartenv: require("smartenv"),
|
||||||
smartfile: require("smartfile"),
|
smartfile: require("smartfile"),
|
||||||
typings: require("typings")
|
smartpath: require("smartpath")
|
||||||
};
|
};
|
||||||
export = plugins;
|
export = plugins;
|
@ -1,6 +1,7 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
import NpmtsConfigFile = require("./npmts.configfile");
|
import NpmtsConfigFile = require("./npmts.configfile");
|
||||||
import NpmtsOptions = require("./npmts.options");
|
import NpmtsOptions = require("./npmts.options");
|
||||||
|
import NpmtsInstall = require("./npmts.install");
|
||||||
import NpmtsCompile = require("./npmts.compile");
|
import NpmtsCompile = require("./npmts.compile");
|
||||||
import NpmtsJsdoc = require("./npmts.jsdoc");
|
import NpmtsJsdoc = require("./npmts.jsdoc");
|
||||||
import NpmtsTests = require("./npmts.tests");
|
import NpmtsTests = require("./npmts.tests");
|
||||||
@ -8,6 +9,7 @@ export var run = function(){
|
|||||||
var promisechain;
|
var promisechain;
|
||||||
NpmtsConfigFile.run()
|
NpmtsConfigFile.run()
|
||||||
.then(NpmtsOptions.run)
|
.then(NpmtsOptions.run)
|
||||||
|
.then(NpmtsInstall.run)
|
||||||
.then(NpmtsCompile.run)
|
.then(NpmtsCompile.run)
|
||||||
.then(NpmtsJsdoc.run)
|
.then(NpmtsJsdoc.run)
|
||||||
.then(NpmtsTests.run);
|
.then(NpmtsTests.run);
|
||||||
|
@ -26,10 +26,14 @@ export var run = function(configArg) {
|
|||||||
var coveralls = function(){
|
var coveralls = function(){
|
||||||
plugins.beautylog.log("now uploading coverage data to coveralls");
|
plugins.beautylog.log("now uploading coverage data to coveralls");
|
||||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"./coverage/lcov.info")])
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"./coverage/lcov.info")])
|
||||||
.pipe(plugins.g.coveralls());
|
.pipe(plugins.g.coveralls())
|
||||||
|
.pipe(plugins.g.gFunction(function(){
|
||||||
|
plugins.beautylog.ok("coverage data has beend uploaded Coveralls!");
|
||||||
|
},"atEnd"));
|
||||||
return stream;
|
return stream;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugins.beautylog.log("now starting tests");
|
||||||
istanbul().on("finish",function(){
|
istanbul().on("finish",function(){
|
||||||
mocha().on("finish",function(){
|
mocha().on("finish",function(){
|
||||||
if(plugins.smartenv.getEnv().isTravis && config.coveralls){
|
if(plugins.smartenv.getEnv().isTravis && config.coveralls){
|
||||||
@ -37,6 +41,7 @@ export var run = function(configArg) {
|
|||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
plugins.beautylog.ok("Tests have passed!");
|
||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user