Added ability to override TypeScript options from asset manifest.

This commit is contained in:
Daniel Stolt
2017-01-13 18:45:58 +01:00
parent cccebea685
commit 937a8f9783

View File

@@ -213,9 +213,11 @@ function buildJsPipeline(assetGroup, doConcat, doRebuild) {
// Source maps are useless if neither concatenating nor transpiling. // Source maps are useless if neither concatenating nor transpiling.
if ((!doConcat || assetGroup.inputPaths.length < 2) && !assetGroup.inputPaths.some(function (inputPath) { return path.extname(inputPath).toLowerCase() === ".ts"; })) if ((!doConcat || assetGroup.inputPaths.length < 2) && !assetGroup.inputPaths.some(function (inputPath) { return path.extname(inputPath).toLowerCase() === ".ts"; }))
generateSourceMaps = false; generateSourceMaps = false;
var typescriptOptions = { allowJs: true, noImplicitAny: true, noEmitOnError: true }; var typeScriptOptions = { allowJs: true, noImplicitAny: true, noEmitOnError: true };
if (assetGroup.typeScriptOptions)
typeScriptOptions = Object.assign(typeScriptOptions, assetGroup.typeScriptOptions); // Merge override options from asset group if any.
if (doConcat) if (doConcat)
typescriptOptions.outFile = assetGroup.outputFileName; typeScriptOptions.outFile = assetGroup.outputFileName;
return gulp.src(assetGroup.inputPaths) return gulp.src(assetGroup.inputPaths)
.pipe(gulpif(!doRebuild, .pipe(gulpif(!doRebuild,
gulpif(doConcat, gulpif(doConcat,
@@ -226,7 +228,7 @@ function buildJsPipeline(assetGroup, doConcat, doRebuild) {
})))) }))))
.pipe(plumber()) .pipe(plumber())
.pipe(gulpif(generateSourceMaps, sourcemaps.init())) .pipe(gulpif(generateSourceMaps, sourcemaps.init()))
.pipe(typescript(typescriptOptions)) .pipe(typescript(typeScriptOptions))
.pipe(header( .pipe(header(
"/*\n" + "/*\n" +
"** NOTE: This file is generated by Gulp and should not be edited directly!\n" + "** NOTE: This file is generated by Gulp and should not be edited directly!\n" +