Skip to content

Commit 97a184b

Browse files
committed
Allowing the TS task's configuration to be extended on an instance-by-instance basis.
1 parent b2f5387 commit 97a184b

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎core-build/gulp-core-build-typescript/src/TypeScriptTask.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import gulpType = require('gulp');
55
import ts = require('gulp-typescript');
66
import * as Typescript from 'typescript';
77
import * as path from 'path';
8+
import * as lodash from 'lodash';
89

910
import { GulpTask, IBuildConfig } from '@microsoft/gulp-core-build';
1011

@@ -68,6 +69,11 @@ export interface ITypeScriptTaskConfig {
6869
* If defined, drop typescript files build using modules=ES6.
6970
*/
7071
libES6Dir?: string;
72+
73+
/**
74+
* If defined, apply these settings on top of the standardized project TypeScript compiler configuration.
75+
*/
76+
configAddons?: ts.Settings;
7177
}
7278

7379
/**
@@ -147,9 +153,13 @@ export class TypeScriptTask extends GulpTask<ITypeScriptTaskConfig> {
147153
this.log(`TypeScript version: ${typescript.version}`);
148154
}
149155
// tslint:disable-next-line:no-any
150-
const compilerOptions: ICompilerOptions =
156+
let compilerOptions: ICompilerOptions =
151157
TypeScriptConfiguration.getGulpTypescriptOptions(this.buildConfig).compilerOptions;
152158

159+
if (this.taskConfig.configAddons) {
160+
compilerOptions = lodash.merge({}, compilerOptions, this.taskConfig.configAddons);
161+
}
162+
153163
TypeScriptConfiguration.fixupSettings(compilerOptions, this.logWarning);
154164

155165
this._tsProject = this._tsProject || ts.createProject(compilerOptions);

0 commit comments

Comments
 (0)