tspackage-stream

Provides a stream interface for the TsPackage minifier and modular Typescript bundle optimizer compiler for use in the gulp build pipeline.

Usage no npm install needed!

<script type="module">
  import tspackageStream from 'https://cdn.skypack.dev/tspackage-stream';
</script>

README

npm version Build Status

tspackage-stream

Streams the output from TsPackage for use within a gulp build pipeline.

Wiki

Additional details can be found on the TsProject wiki.

How to install

npm install tspackage-stream

API

tspackage.src( tsProjectConfigPath: string, settings: any )

Where:

tsProjectConfigPath is a relative directory path to the default Typescript project file named "tsconfig.json". Or, projectConfigPath is a relative path to a named Typescript project file.

Usage - Gulp Build Pipeline

TsProject on github contains a TodoMVC sample to help you get started. The sample is built using Angular, Typescript ES6 modules and Require.

Here is a simple gulpfile.js:

var gulp = require( 'gulp' );
var tspackage = require( 'tspackage-stream' );

gulp.task( 'build', function() {

    // path to directory of tsconfig.json provided
    tspackage.src( './src/project' )
        .pipe( gulp.dest('./build') );

    // path to named configuration file provided and optional settings specified 
    return tspackage.src( './src/project/myconfig.json',
        { 
            logLevel: 1,
            compilerOptions: {
                listFiles: true
            } 
        })
        .pipe( gulp.dest( './mybuild' ) );

});

Building tspackage-stream

TsProject depends on NPM as a package manager and Gulp as a build tool. If you haven't already, you'll need to install both these tools in order to build tspackage-stream.

Once Gulp is installed, you can build it with the following commands:

npm install
gulp build