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-16 10:28:57 +00:00
|
|
|
header: require("gulp-header")
|
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-01-18 14:15:15 +00:00
|
|
|
plugins.gulp.task('indexTS', 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.g.header('#!/usr/bin/env node\n\n'))
|
|
|
|
.pipe(plugins.gulp.dest(plugins.path.join(paths.packageBase, 'dist/')));
|
|
|
|
return stream;
|
2016-01-14 18:25:36 +00:00
|
|
|
});
|
|
|
|
|
2016-01-18 14:15:15 +00:00
|
|
|
plugins.gulp.task('default',['indexTS'], 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']);
|