kant2002 / gulp-tsc Goto Github PK
View Code? Open in Web Editor NEWThis project forked from kotas/gulp-tsc
gulp.js plugin for compiling TypeScript files
License: MIT License
This project forked from kotas/gulp-tsc
gulp.js plugin for compiling TypeScript files
License: MIT License
Hi
In the documentation you claim support for: suppressImplicitAnyIndexErrors but it is being ignored. Looking in your code, I could not see it either. Is this feature supported?
Thanks!
Please add the new tsc option eg. --strict
, --checkJs
etc.
https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript
In my environment I need the opiton "isolatedModules". Unfortunately this option is not available in the current version of gulp-tsc. Is there a way to set the option on a other way? Or could you tell me, when the option would be supported by gulp-tsc.
Thanks!!
The value of jsx
must be either 'react' or 'preserve' but gulp-tsc ignores the value of the jsx option passed in and throws an error. (The Readme is also wrong because it lists the jsx option twice)
I can work around it using additionalTscParameters
.
If I put this in my gulpfile.js
gulp.task("build", function () { gulp.src(paths.ts) .pipe(typescript({ target: "es5", sourceMap: true, experimentalDecorators: true, lib: ["es2015", "dom"], noImplicitAny: true })) .pipe(gulp.dest('temp/')) });
This gets put into the file passed to tsc.
"--lib"
"dom"
"--lib"
"es2015"
Passing in two --lib options is not good. Only the last one get processed.
I changed the code to this to get it working.
if (this.options.lib && versionCompare(version, "1.8") >= 0) { var param = ""; for (let libName of this.options.lib) { param += libName + ", "; } if(param.length > 0){ param = param.substring(0, param.length - 2); args.push('--lib', param); } }
Now I get this in the file and tsc likes it.
"--lib"
"dom, es2015"
I guess i did something wrong, but I don't understand why starting with :
I end up with : (I had to stop the script from running, otherwise it never stops adding files and folders)
While the file is correctly compiled...
Here is my script :
var gulp = require('gulp');
var typescript = require('gulp-tsc');
gulp.task('compileTS', function() {
gulp.src(['**/*.ts', '!node_modules/**'])
.pipe(typescript({
target: 'ES5'
}))
.pipe(gulp.dest('.'));
});
gulp.task('watch:ts', function() {
gulp.watch(['**/*.ts', '!node_modules/**'], ['compileTS']);
});
I just ran the gulp watch:ts
command.
following this https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5:
please remove gulp-util using the following API replacements:
gutil.File => https://www.npmjs.com/package/vinyl
gutil.replaceExtension => The .extname property on Vinyl objects or https://www.npmjs.com/package/replace-ext
gutil.colors => https://www.npmjs.com/package/ansi-colors
gutil.date => https://www.npmjs.com/package/date-format
gutil.log => https://www.npmjs.com/package/fancy-log
gutil.template => https://www.npmjs.com/package/lodash.template
gutil.env => https://www.npmjs.com/package/minimist
gutil.beep => https://www.npmjs.com/package/beeper
gutil.noop => https://www.npmjs.com/package/through2
gutil.isStream => Use the .isStream() method on Vinyl objects
gutil.isBuffer => Use the .isBuffer() method on Vinyl objects
gutil.isNull => Use the .isNull() method on Vinyl objects
gutil.linefeed => Use the string '\n' in your code
gutil.combine => https://www.npmjs.com/package/multipipe
gutil.buffer => https://www.npmjs.com/package/list-stream
gutil.PluginError => https://www.npmjs.com/package/plugin-error
Please add support for these properties.
Is it possible to use an existing tsconfig to setup the gulp-tsc? Because with the gulp-tsc options I could not configure moduleResolution
or the exclude
section.
Thx
Regards
typescript({
project: "tsconfig.json",
}
Results in:
--module commonjs --target ES3 --project tsconfig.json
Expected:
--project tsconfig.json
Workaround:
typescript({
project: "tsconfig.json",
target: "ES5",
}
Results in:
--module commonjs --target ES5 --project tsconfig.json
It messes up my code as tsconfig.json can define another module and target, and I don't want to duplicate the options.
Hello, how fix this?
const gulp = require('gulp');
const nodemon = require('gulp-nodemon');
const ts = require('gulp-tsc');
//-------------------------------------
gulp.task('start', ()=> {
nodemon({
script: 'index.js'
, ext: 'js html'
, env: { 'NODE_ENV': 'development' }
})
});
//-------------------------------------
//gulp.watch('client/src/**/*.ts',['script']);
//-------------------------------------
gulp.task('script', ()=>{
gulp.src('client/src/**/*.ts')
.pipe(ts({
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"emitError": false
}));
});
//-------------------------------------
gulp.task('default',['start','script']);
Hello,
I have a problem with '&' character in project folder path. How can I fix it ?
Thanks !
Failed to compile TypeScript: Error: Command failed: /bin/sh -c /usr/local/bin/node /Volumes/DataHD/R&D/Personnel/JJ/Developpement/project/node_modules/typescript/bin/tsc -v
/bin/sh: D/Personnel/Jobware/Developpement/project/node_modules/typescript/bin/tsc: No such file or directory
module.js:338
throw err;
^
Error: Cannot find module '/Volumes/DataHD/R'
It does say "up to 1.6.3" near the bottom but preferably you would just redirect folks doing new development to gulp-typescript at the top -- assuming continuing development for this module is terminating.
This plugin has been blacklisted in the official gulp plugins repository, with the reason operates directly on file paths. does too much
. Besides that, it looks like similar behavior can be achieved with gulp-typescript
(which uses the TypeScript compiler api instead of the tsc
command). Following the gulp guidelines, can you instead of creating & maintaining your own plugin, consolidate your work into gulp-typescript? Are there features missing in gulp-typescript that are present in gulp-tsc? If so, we can take a look at how these can be implemented in gulp-typescript.
When using it, I get [tsc] > error TS5042: Option 'project' cannot be mixed with source files on a command line.
.
If I don't pass anything to gulp.src
gulp will error, if I do, tsc will error.
Hi, I tried to install gulp-tsc into my environment, and it faild with typescript dependecy anyway as you can see on my terminal output I have installed [email protected] before trying to install gulp-tsc
root@nas:/srv/dev-disk-by-label-SGBarracuda/node/mypvrworker# npm install -g typescript
/opt/node/bin/tsc -> /opt/node/lib/node_modules/typescript/bin/tsc
/opt/node/bin/tsserver -> /opt/node/lib/node_modules/typescript/bin/tsserver
/opt/node/lib
└── [email protected]
root@nas:/srv/dev-disk-by-label-SGBarracuda/node/mypvrworker# npm install -g gulp-tsc
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
/opt/node/lib
├── [email protected]
└── UNMET PEER DEPENDENCY typescript@>=1.0.1 || 2.x
root@nas:/srv/dev-disk-by-label-SGBarracuda/node/mypvrworker# node -v
v6.11.2
root@nas:/srv/dev-disk-by-label-SGBarracuda/node/mypvrworker# npm -v
3.10.10
root@nas:/srv/dev-disk-by-label-SGBarracuda/node/mypvrworker#
[16:09:14] [tsc] > C:/Sandbox/Master-Template/src/app/app.ts(2,5): error TS2304: Cannot find name 'angular'.
[16:09:14] [tsc] > C:/Sandbox/Master-Template/src/app/app.ts(18,5): error TS2304: Cannot find name 'angular'.
[16:09:14] [tsc] > C:/Sandbox/Master-Template/src/app/app.ts(19,17): error TS2339: Property '$inject' does not exist on type '($routeProvider: any, $mdThemeingProvider: any) => void'.
[16:09:14] [tsc] > C:/Sandbox/Master-Template/src/app/app.ts(21,42): error TS2503: Cannot find namespace 'ng'.
[16:09:14] [tsc] > C:/Sandbox/Master-Template/src/app/app.ts(22,30): error TS2503: Cannot find namespace 'ng'.
[16:09:14] [tsc] > C:/Sandbox/Master-Template/src/app/home/homeCtrl.ts(15,5): error TS2304: Cannot find name 'angular'.
[16:09:14] Failed to compile TypeScript: Error: tsc command has exited with code:2
[16:09:14] Plumber found unhandled error:
Error in plugin 'gulp-tsc'
All these errors yet it works fine. I also have emitError set to true in the options.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.