node package manager

gulp-typescript-package

Typescript package

This gulp task takes a serie of typescript files and complies them into one output file. Additionally this task generates a corresponding sourcemap, declaration file and a minified version.

This gulp task is usefull when you have a set of typescript files/classes that should be bundled into one file.

It uses directly on the original typescript complier ( typescript ). So it does not follow strictly the gulp rules, as the typescript compiler writes the files directly. Instead of sending them into the stream.

Usage

An example usage with gulp:

var gulp        = require('gulp');
var tsc = require( 'gulp-typescript-package' );
 
gulp.task('my-package', function() {
    return gulp.src( 'my/source/**.ts' )
    .pipe( tsc( { out:'build/', name:'my-package' } ) );
});

This will generate the following files: build/my-package/my-package.js' The js file including the comments and the sourcemap reference.build/my-package/my-package.min.js' The minified version. build/my-package/my-package.js.map' The sourcemap file.build/my-package/my-package.d.ts' The typescript declaration file when using in another project.

Options

{ out:'folder' } The output folder where to create the files. { name:'my-package' } The name of the package. { sourceRoot:'source/root' } The path to the source folder where the *.ts files are.