GTypeScriptBuilder

typescript builder.

Builder specific Options

Available options for BuildConfig.buildOptions:

OptionTypeDefaultDescription
sourceMapbooleanfalseEnable sourceMap generation.
lintbooleanfalseEnable linter.
minifybooleanfalseGenerate minified *.min.js in addition to non-minified output.
minifyOnlybooleanfalseGenerate minified *.min.js files only with no non-minified output.
outFileOnlybooleantrueNot supported. See notes below.
tsConfigstringundefinedPath to typescript configuration file.
declarationMapbooleanfalseGenerate declaration map files.
printConfigbooleanfalsePrint evaluated TypeScript options(tsconfig)

Notes

  • If BuildConfig.outFile is set, it will override the outFile setting of tsconfig.json
  • If both BuildConfig.outFile and BuildConfig.dest is set, BuildConfig.dest will override the outDir setting of tsconfig.json
  • buildOptions.outFileOnly option is not supported. TypeScript compiler always generates outFile only. If non-concatenated each individual files need to be generated, create another build configuration without outFile option.

Example

const typeScript = {
name: 'typeScript',
builder: 'GTypeScriptBuilder',
src: [upath.join(srcRoot, 'scripts/ts/**/!(*.d).ts')],
// use order property to set outFile orders
order: ['*ts-2.ts'],
dest: (file) => file.base,
outFile: upath.join(destRoot, 'js/sample-ts.js'),
buildOptions: {
sourceMap: true,
minify: true,
// You can specify tsconfig.json file here. To create a default one, run 'tsc -init'
tsConfig: upath.join(srcRoot, 'scripts/tsconfig.json'),
printConfig: true
},
moduleOptions: {
// this will override the tsConfig settings in buildOptions
typescript: {
"outFile": "sample-ts.js",
"outDir": upath.resolve(destRoot, 'js'),
"declarationDir": upath.resolve(destRoot, '@types'),
"target": "es5",
"module": "none",
"noImplicitAny": true,
"noEmitOnError": true
}
},
};