title: Using Gulp how to first compile Typescript then concatenate the result and uglify it?
body: <p>I'm working on a project using <code>Typescript</code> currently I'm facing a problem compiling <code>Typescript</code> and then concatenate the result using <code>Gulp</code>.</p>
  
  <pre><code>var gulp = require('gulp');
  var ts = require('gulp-typescript');
  var concat = require('gulp-concat');
  var uglify = require('gulp-uglify');
  
  gulp.task('default', function () {
      gulp.src('vendor/**/*.js')
          // I want to add ts files then combile and concat
          .gulp.src('src/**/*.ts')
          .pipe(sourcemaps.init())
          .pipe(ts({
              noImplicitAny: true,
              out: 'output.js'
          }))
          .pipe(concat('all.js'))
          .pipe(uglify());
          .pipe(sourcemaps.write('/'))
          .pipe(gulp.dest('./dist/'));
  });
  </code></pre>
  
  <p>In words what I need to do is:</p>
  
  <ol>
  <li>Get the external <code>JavaScript</code> libraries.</li>
  <li>Get <code>Typescripts</code>.</li>
  <li>Compile <code>Typescripts</code> with source map.</li>
  <li>Concat the result to the previously added <code>JavaScript</code>.</li>
  <li>Uglify them.</li>
  <li>Create the sorce map.</li>
  <li>Save the result into some folder.</li>
  </ol>
  
  <blockquote>
    <p><strong>Update</strong></p>
    
    <p>Or just a way to make sure that the <code>TypeScript</code> is compiled before
    proceeding with concatenating the result with <code>JavaScript</code>.</p>
  </blockquote>