node package manager
Orgs are free. Discover, share, and reuse code in your team. Create a free org »


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.


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' The minified version. build/my-package/' The sourcemap' The typescript declaration file when using in another project.


{ 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.