2016-01-14 18:25:36 +00:00
|
|
|
// import gulp
|
|
|
|
var plugins = {
|
2016-01-18 14:15:15 +00:00
|
|
|
beautylog: require("beautylog"),
|
|
|
|
gulp: require("gulp"),
|
|
|
|
g:{
|
|
|
|
typescript: require("gulp-typescript"),
|
2016-02-23 19:02:07 +00:00
|
|
|
typings:require("gulp-typings")
|
2016-01-18 14:15:15 +00:00
|
|
|
},
|
2016-02-19 23:53:23 +00:00
|
|
|
mergeStream: require("merge2"),
|
|
|
|
path: require("path")
|
2016-01-14 18:25:36 +00:00
|
|
|
};
|
|
|
|
|
2016-02-19 23:53:23 +00:00
|
|
|
paths = {
|
|
|
|
packageBase: plugins.path.resolve(
|
|
|
|
plugins.path.join(__dirname,"../")
|
|
|
|
)
|
|
|
|
};
|
2016-01-18 14:15:15 +00:00
|
|
|
|
2016-01-31 21:24:57 +00:00
|
|
|
plugins.beautylog.log('now compiling NPMTS');
|
2016-01-14 18:25:36 +00:00
|
|
|
|
2016-02-23 19:02:07 +00:00
|
|
|
plugins.gulp.task("typings",function(){
|
|
|
|
var stream = plugins.gulp.src(plugins.path.join(paths.packageBase,"ts/typings.json"))
|
|
|
|
.pipe(plugins.g.typings());
|
|
|
|
return stream;
|
|
|
|
});
|
|
|
|
|
2016-02-25 07:26:00 +00:00
|
|
|
plugins.gulp.task("TS",["typings"], function() {
|
2016-02-19 23:53:23 +00:00
|
|
|
var stream = plugins.gulp.src([
|
|
|
|
plugins.path.join(paths.packageBase,'ts/**/*.ts'),
|
|
|
|
"!" + plugins.path.join(paths.packageBase,'ts/typings/**/*.d.ts')
|
|
|
|
])
|
2016-01-18 14:15:15 +00:00
|
|
|
.pipe(plugins.g.typescript({
|
2016-02-19 23:53:23 +00:00
|
|
|
target:"ES5",
|
|
|
|
module:"commonjs"
|
|
|
|
}))
|
|
|
|
.pipe(plugins.gulp.dest(plugins.path.join(paths.packageBase, 'dist/')));
|
|
|
|
return stream;
|
2016-01-14 18:25:36 +00:00
|
|
|
});
|
|
|
|
|
2016-02-25 07:26:00 +00:00
|
|
|
plugins.gulp.task("CLI",function(){
|
|
|
|
var stream = plugins.gulp.src(plugins.path.join(paths.packageBase,"assets/cli.js"))
|
|
|
|
.pipe(plugins.gulp.dest(plugins.path.join(paths.packageBase, 'dist/')))
|
|
|
|
});
|
|
|
|
|
|
|
|
plugins.gulp.task('default',['TS',"CLI"], function() {
|
2016-01-14 18:25:36 +00:00
|
|
|
plugins.beautylog.success('Typescript compiled');
|
|
|
|
});
|
|
|
|
|
2016-01-18 14:15:15 +00:00
|
|
|
plugins.gulp.start.apply(plugins.gulp, ['default']);
|