Giter Club home page Giter Club logo

gulp-tsc's People

Contributors

ccll avatar kotas avatar youpy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gulp-tsc's Issues

[tsc] > The command line is too long. When compiling a lot of files

The TypeScript compiler can take in all command line arguments via a temporary file, as described here:
http://stackoverflow.com/questions/12699781/how-can-i-pass-multiple-source-files-to-the-typescript-compiler

We encountered this error months and months ago prior to using gulp, when Microsoft was forced to do the same thing (pass all the source file names and arguments in via file). Could you make this change to
/lib/compiler.js to support this argument file? I will be working on a pull request myself

Fails on .d.ts file

The plugin appears to throw an error when compiling a .d.ts file because there is no .js file output. It appears to be trying to open the file, but it does not exist.

I think it's common to put a single .d.ts file in the root of the application and reference it from the rest of the project.

Support direct command line params

It will be useful to support specifying tsc command line arguments directly, as simple string.
TSC is growing up, 1.4.1 is on air, and some new keys added - --suppressImplicitAnyIndexErrors --preserveConstEnums, etc...
In fact, we can tract each property of options object as tsc argument, and pass it directly (if option name is unknown), with conversion of boolean values, whereas string values passed as they are.

Compling error in Windows 8

Hi there,
I'm getting an error when I use your plugin in Windows 8. In Linux works fine though.

[gulp] Failed to compile TypeScript: Error: Command failed: The filename, directory name, or volume label syntax is incorrect

There's no way to specify flags such as --emitDecoratorMetadata

I am using gulp-tsc to compile TypeScript files in an Angular 2 application. According to Angular's doc the files must be generated with the following line:

tsc --watch -m commonjs -t es5 --emitDecoratorMetadata file.ts

My gulpfile.js file is as follows:

gulp.task('compile-ts', function(){
  return gulp.src(['resources/angular/**/*.ts'])
    .pipe(typescript({target : "ES5", module : "commonjs" }))
    .pipe(gulp.dest('./public/angular/'))
    .pipe(plugins.livereload());
});

It supports specifying ES5 and commonjs but there's no way to add the flag --emitDecoratorMetadata

Prevent TypeScript beta version from getting installed

I just re-installed gulp-tsc and it brought typescript 1.1.0-1 with it - the newest beta version of the typescript compiler, which is still buggy and doesn't compile my code. Perhaps it is wise to adjust package.json so that only typescript 1.0.x versions will get installed?

Use watch option for tsc

Hello,

I'm trying gulp-tsc and it seems when you're watching, it restarts the compiler every time a file changes (and it takes about 2-3s on my machine).

Is it possible to have an option to start the compiler with the -w option as it should be much faster.

I'll have a look at the code later this week but let me know what you think of it

Declaration files get the wrong reference

I have the following in my gulpfile.js:

gulp.task("typescript", function() {
     return gulp.src([
            "/**/*.ts",
        ], {base: "."})
        .pipe(gulpFilter("!**/*.d.ts"))
        .pipe(typescript({
            module: "commonjs",
            declaration: true,
            target: "es5",
        }))
        .pipe(gulp.dest("."))
});

This generates all .js and .js.map files correctly and the .d.ts files look fine too, except that any reference to a .d.ts file (e.g. /// <reference path="../typings/lib.d.ts"/>) will get mangled to one level too far back and becomes
/// <reference path="../../typings/lib.d.ts"/>, which is of course wrong, because the .d.ts files are written in the same directory as the .ts source files.

I did a bit of debugging here, and I think that the reason for this behavior is because the files are first generated to a temporary directory (gulp-tsc-tmp-*) and then copied back to their eventual destination. Because I used gulp.dest(".") I assumed that these references would stay intact, but apparently they do not.

Windows 7 error

Hello.

I am having strange error when trying to compile any .ts via gulp-tsc (tried both 0.0.2 and 0.0.3)
Here is the output:

[gulp] Failed to compile TypeScript: Error: Command failed:
module.js:340
    throw err;
          ^
Error: Cannot find module '...\Documents\frontend\tool\'C:\Program'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

Seems like the module path is screwed.
However, in Ubuntu it works.
Any idea for workaround?
Thanks.

In windows, error messages are displayed as "Buffer"

[11:11:30] [tsc] > <Buffer 6d 65 73 73 61 67 65 20 54 53 36 30 38 31 3a 20 41 72 67 75 6d 65 6e 74 20 66 6f 72 20 27 2d 2d 6a 73 78 27 20 6d 75 73 74 20 62 65 20 27 70 72 65 73 ... >

It looks like the lib "byline" is causing the issue but I'm not quite sure.
Changing lines 227 to 235 in compiler.js "fixes" the issue.

proc.on('error', function (err) {
    _this.emit('error', err);
  });
  stdout.on('data', function (chunk) {
    _this.emit('stdout', chunk.toString('utf8'));
  });
  stderr.on('data', function (chunk) {
    _this.emit('stderr', chunk.toString('utf8'));
  });

Node version is v6.2.2, gulp-tsc is 1.1.5 and tsc is 1.8.10.

Unhandled error when compilation failed

I use gulp-tsc with watch task.
If i have an error in my ts files and hit save, an unhandled error is thrown and gulp exits.

I believe this error should be caught so that i can fix my code without restarting gulp

Temp Folders are not cleaned up.

In my project I have multiple typescript file groups that need to be compiled separately (a library, and it's unit tests). I have tried adding them both to the same task, and separate tasks. They compile successfully, but the 2nd task leaves behind a temp folder in the project root containing the output file from the 2nd compilation.

Double backslashes on Windows

gulp-tsc uses a 'shellescape' function that processes the arguments passed to tsc. This function replaces backslashes by double backslashes. This results in invalid paths on Windows. Some Windows versions don't care (e.g. Windows 7) but others do (e.g. Windows 8, Windows Server 2008). I have several computers where gulp-tsc does not work for this reason.

Would it be possible to disable backslash escaping on Windows?

allowBool does not work

Hi, using

tsc( {allowBool : true})

it will still say angular.d.ts(32,43): Cannot find name 'bool'.

besides, the gulp-tsc docu is wrong, it "Bool" is uppercase and should be enabled by default

Duplicate output directory when input file refers to files outside (v0.5.1)

Reported by @bestander in #18 (comment)


Hi, thanks for the best gulp tsc task.
I think this pull request broke my build and I reverted to version 0.5.0.

This is my setup:

gulp.task('compile-typescript', function() {
    return gulp.src(['app/**/*.ts'])
        .pipe(cache('typescript'))
        .pipe(typescript(typescriptOptions))
        .pipe(gulp.dest(webOutputPath + '/app'));
});
gulp.task('dev', function(callback) {
    runSequence('clean-web-output',
        ['compile-typescript', 'compile-sass' ],//, 'run-tests'],
        function() {
            gulp.watch(['app/**/*.ts'], ['compile-typescript']);
        });
});

If I change one TS file I expect 1 or more JS files to be compiled into my .tmp folder.

For example if I change:

/app/online-reader/popup-reader-directive.ts

Then compiler produces this list:

<tmp>/online-reader/popup-reader-directive.js
<tmp>/online-reader/reader-preferences-service.js
<tmp>/analytics/http-latency-sampler.js

The change in this ticket changes it to:

<tmp>/online-reader/online-reader/popup-reader-directive.js
<tmp>/online-reader/online-reader/reader-preferences-service.js
<tmp>/online-reader/analytics/http-latency-sampler.js

Which os wrong.

I am happy to debug or provide more test data.

References are messed up on (d.ts)

While compiling typescript using gulp-tsc , I seem to encounter a strange issue. The file references on the d.ts seems to be messed up.

Source :

///<reference path='typings/lodash/lodash.d.ts'/>
///<reference path='typings/angularjs/angular.d.ts'/>

Gulp

    return gulp.src('src/gravy/gravy.ts')
        .pipe(tsc({sourcemap: true,declaration:true,logErrors: true, out:'gravy.js',outDir:'src/gravy'}))
        .pipe(gulp.dest('src/gravy'));

Generated d.ts file.

/// <reference path="typings/lodash/lodash.d.ts" />
/// <reference path="../src//gravy/typings/angularjs/angular.d.ts" />

See the generated file , the references are messed up. Its strange that the first line is good , the second line always seems to be messed. I reversed the order on the source to see same symptom.
The generated mapping file out of equivalent typescript CLI is good. Any ideas ?

Thanks
Santhosh

Feature request: search for typescript compiler in parent directories

The feature where gulp-tsc will use the typescript compiler in node_modules is helpful in the case that different projects are using different versions of typescript (I'm in this situation).

In my case, it would also be helpful if instead of just searching for typescript in the ./node_modules it would also search in ../node_modules, ../../node_modules, etc.

What do you think?

Thanks,

Chris

Under 0.5.0, output files are missing

I upgraded to 0.5.0 from 0.0.4, and I don't see any .js files after doing a build.

Here is my gulp task:

gulp.task('typescript', ['clean'], function() {
    var typescript = require('gulp-tsc');

    return gulp.src(['./**/*.ts', '!./node_modules/**'], { read: false })
      .pipe(typescript({ noImplicitAny: true, target: 'ES5', module: 'COMMONJS', sourcemap: true }))
      .pipe(gulp.dest('.'));
  });

 gulp.task('build', ['clean', 'typescript'], function(){

  });

Here is a screencast which attempts to demonstrate that I am not crazy:

http://screencast.com/t/JX1y89rA

Cross-project dependencies

I have two typescript projects (app and util). The app project references files in the util project.

I set up my gulp-tsc with sources from the app project, but during compilation, the typescript compiler also compiles files in the util project. This is mostly ok, but because the util files don't get added to the gulp output files, there's a couple caveats:

  • The files under util don't get moved to the destination. This is actually a good thing because I wouldn't want them moved under app.
  • Further "pipes" in the gulp stream don't get applied to the util files.

I'm not even sure there's anything worthwhile to do about this, but just thought I'd bring it up to see if you had any ideas.

Thanks,

Chris

Incorrect reference path in generated definition file

Hello!

I successfully compiled my .ts script using command line:

tsc source/ts/docmaster/document/Explorer.class.ts --module commonjs --target ES5 --out source/ts/d.ts/docmaster/docmaster.js --declaration --noEmitOnError --removeComments

In compiled .d.ts file I see correctly used references.

/// <reference path="../DefinitelyTyped/jstorage/jstorage.d.ts" />
/// <reference path="../jquery/a2j.d.ts" />
/// <reference path="../DefinitelyTyped/q/Q.d.ts" />

I need to reproduce compiling in gulp script

gulp.task('test', function (callback) {
    gulp.src([
        'source/ts/docmaster/document/Explorer.class.ts'
    ])
        .pipe(tsc({
            module: 'commonjs',
            target: 'ES5',
            out: 'source/ts/d.ts/docmaster/docmaster.js',
            declaration: true,
            noEmitOnError: true,
            removeComments: true
        }))
        .pipe(gulp.dest(''))
        .pipe(notify('docmaster.js compiled'));
});

But in compiled d.ts my references are different:

/// <reference path="../../../../../source/ts/d.ts/DefinitelyTyped/jstorage/jstorage.d.ts" />
/// <reference path="../../../../../source/ts/d.ts/jquery/a2j.d.ts" />
/// <reference path="../../../../../source/ts/d.ts/DefinitelyTyped/q/Q.d.ts" />

Why?

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.