(subdir, options)
| 72 | // - build w/ tsc |
| 73 | // - dist w/ browserify |
| 74 | function tsTask(subdir, options) { |
| 75 | options = options || {}; |
| 76 | var noBuffer = options.noBuffer; |
| 77 | var noGlobal = options.noGlobal; |
| 78 | var buildDeps = options.buildDeps || []; |
| 79 | var otherSources = options.otherSources || []; |
| 80 | var sources = ['src/'+subdir+'/*.ts', 'src/'+subdir+'/**/*.ts'].concat(otherSources); |
| 81 | |
| 82 | gulp.task('lint-'+subdir, function() { |
| 83 | return gulp.src(['src/'+subdir+'/*.ts', 'src/'+subdir+'/*/*.ts']) |
| 84 | .pipe(lint({ |
| 85 | formatter: "verbose" |
| 86 | })) |
| 87 | .pipe(lint.report()); |
| 88 | }); |
| 89 | |
| 90 | // run lint by default, but if lint is specified as 'false' skip it |
| 91 | if (!options.hasOwnProperty('lint') || options.lint) |
| 92 | buildDeps = buildDeps.concat(['lint-'+subdir]); |
| 93 | |
| 94 | gulp.task('build-'+subdir, buildDeps, tsPipeline(sources, 'lib/'+subdir)); |
| 95 | |
| 96 | var globals = extend({}, globalVars); |
| 97 | if (noGlobal) |
| 98 | globals['global'] = function() { return ""; }; |
| 99 | if (noBuffer) { |
| 100 | globals['buffer'] = function() { return ""; }; |
| 101 | globals['Buffer'] = function() { return ""; }; |
| 102 | } |
| 103 | |
| 104 | gulp.task('dist-'+subdir, ['build-'+subdir], function() { |
| 105 | var b = browserify({ |
| 106 | entries: ['./lib/'+subdir+'/'+subdir+'.js'], |
| 107 | builtins: builtins, |
| 108 | insertGlobalVars: globals, |
| 109 | }); |
| 110 | b.exclude('webworker-threads'); |
| 111 | |
| 112 | return b.bundle() |
| 113 | .pipe(source('./lib/'+subdir+'/'+subdir+'.js')) |
| 114 | .pipe(buffer()) |
| 115 | // .pipe(uglify()) |
| 116 | .on('error', gutil.log) |
| 117 | .pipe(gulp.dest('./lib-dist/')); |
| 118 | }); |
| 119 | } |
| 120 | |
| 121 | gulp.task('copy-node-kernel', function() { |
| 122 | return gulp.src([ |
no test coverage detected