tscoverage/ts/npmts.default.ts

59 lines
2.0 KiB
TypeScript
Raw Normal View History

2016-01-16 13:33:09 +00:00
/// <reference path="./index.ts" />
module NpmtsDefault {
2016-01-30 04:29:54 +00:00
export var run = function() {
var done = plugins.q.defer();
2016-02-04 19:41:34 +00:00
plugins.gulp.task("defaultTypings",function(cb){
plugins.beautylog.log("now installing default typings");
plugins.typings.install({production: false, cwd: paths.tsDir})
.then(function(){
cb();
});
});
2016-01-18 17:59:44 +00:00
plugins.gulp.task("defaultIndexTS", function(){
2016-01-18 18:11:42 +00:00
plugins.beautylog.log("now compiling" + " ts/index.ts".blue);
2016-01-18 14:15:15 +00:00
var tsResult = plugins.gulp.src(paths.indexTS)
.pipe(plugins.g.typescript({
2016-02-04 19:41:34 +00:00
out:"./index.js",
2016-01-18 14:15:15 +00:00
declaration:true
}));
return plugins.mergeStream([
tsResult.dts.pipe(plugins.gulp.dest(paths.cwd)),
tsResult.js
.pipe(plugins.g.insert.prepend('#!/usr/bin/env node\n\n'))
.pipe(plugins.gulp.dest(paths.cwd))
]);
2016-01-16 13:33:09 +00:00
});
2016-01-18 17:59:44 +00:00
plugins.gulp.task("defaultTestTS", function(){
2016-01-18 18:11:42 +00:00
plugins.beautylog.log("now compiling" + " ts/test.ts".blue);
var stream = plugins.gulp.src(paths.testTS)
2016-01-18 14:15:15 +00:00
.pipe(plugins.g.typescript({
2016-01-16 13:33:09 +00:00
out: "test.js"
}))
.pipe(plugins.gulp.dest(paths.testDir));
return stream;
2016-01-16 13:33:09 +00:00
});
2016-01-18 18:11:42 +00:00
plugins.gulp.task("defaultCleanup",function(cb){
2016-02-04 19:41:34 +00:00
plugins.beautylog.success("default TypeScript for this module compiled successfully.");
2016-01-30 04:29:54 +00:00
done.resolve();
2016-01-18 18:11:42 +00:00
cb();
});
2016-01-18 17:59:44 +00:00
plugins.gulp.task("default",function(cb){
2016-02-04 19:41:34 +00:00
if(NpmtsOptions.config.mode == "default"){
plugins.g.sequence("defaultTypings","defaultIndexTS","defaultTestTS","defaultCleanup",cb);
} else {
cb();
done.resolve();
}
2016-01-16 13:33:09 +00:00
});
plugins.gulp.start.apply(plugins.gulp, ['default']);
2016-01-30 04:29:54 +00:00
return done.promise;
2016-01-16 13:33:09 +00:00
}
}