gulp-typescript
gulp-typescript copied to clipboard
Is there something like "tsProject.out()"?
I am using gulp-typescript v3.1.6 and configured a gulp task with it:
const gulp = require('gulp');
const gulpTypeScript = require('gulp-typescript');
const tsProject = gulpTypeScript.createProject("tsconfig.json");
gulp.task('dist', () => {
return tsProject.src()
.pipe(tsProject())
.js.pipe(gulp.dest('dist/commonjs'));
});
I would like to avoid the declaration of gulp.dest('dist/commonjs') because the output directory is already configured in the compiler options within my tsconfig.json (property "outDir"). So is there something like tsProject.out()?
This is my current workaround:
const gulp = require('gulp');
const gulpTypeScript = require('gulp-typescript');
const tsConfig = require('./tsconfig.json');
const tsProject = gulpTypeScript.createProject("tsconfig.json");
gulp.task('dist', () => {
return tsProject.src()
.pipe(tsProject())
.js.pipe(gulp.dest(tsConfig.compilerOptions.outDir));
});
I have been thinking on such a function, and call it tsProject.dest(). It's sadly not implemented yet. There was not an issue for that yet, so we can track that in this issue. Feel free to send a PR for this feature as I'm busy with some other projects currently.
@bennyn
Even easier is to use tsProject.options.outDir.
I think it better than fidgeting with config file