Giter Site home page Giter Site logo

Comments (3)

matthewjh avatar matthewjh commented on July 28, 2024

If it turns out that implementing streams is going to be too much work, IMO it would still be very useful to be able to pass a callback to the bundle function.

from dts-bundle.

heruan avatar heruan commented on July 28, 2024

Gulp/streams support would be awesome 👍

from dts-bundle.

tolemac avatar tolemac commented on July 28, 2024

I think this enhancement is a "nice to have" but not necessary.
Gulp plugins are nice when you have to do something with a set of files that they are piped by one and another processes. In this case, dts-bundle take a file as origin and one destination file, I don't see others uses where works with streams are needed. Let me know if you find cases where it's necessary.

I'm using dts-bundle with gulp this way:

var gulp = require('gulp');
var ts = require('gulp-typescript');
var merge = require('merge2');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
var runSequence = require('run-sequence');
var del = require('del');
var dtsBundle = require('dts-bundle');

var tsProject = ts.createProject('tsconfig.json');

gulp.task('compile', function() {
    var tsResult = tsProject.src() // instead of gulp.src(...)
        .pipe(ts(tsProject));

    return merge([
        tsResult.dts.pipe(gulp.dest('dist/dts')),
        tsResult.js.pipe(gulp.dest('dist/js'))
    ]);
});

gulp.task('bundle', function() {
    var es5 = gulp.src('dist/js/src/**/*.js')
    .pipe(sourcemaps.init())
    .pipe(concat('Ng2Emulation-es5.js'))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('dist/release'));

    return es5;
});

gulp.task('clean', function(){
   del([
        './dist'        
    ]); 
});

gulp.task('definition-bundle', function(){    
    dtsBundle.bundle({
        name: 'Ng2Emulation',
        main: 'dist/dts/src/Ng2Emulation.d.ts',
        out: "dist/release/Ng2Emulation.d.ts",
        exclude: /.*typings.*/,
        verbose: true
    });
});

gulp.task('build', function(done) {
  runSequence('clean', 'compile', 'bundle', 'definition-bundle', done);
});

I have definition-bundle task as isolate task, not integrate with the compile process. This way I don't need to use streams. I only need that dts-bundle works with others processes.

Any way, I think this will be a "nice to have" enhacement, of course, but not necessary.

from dts-bundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.