GTypeScriptBuilder
typescript builder.
Builder specific Options
Available options for BuildConfig.buildOptions:
Option | Type | Default | Description |
---|---|---|---|
sourceMap | boolean | false | Enable sourceMap generation. |
lint | boolean | false | Enable linter. |
minify | boolean | false | Generate minified *.min.js in addition to non-minified output. |
minifyOnly | boolean | false | Generate minified *.min.js files only with no non-minified output. |
outFileOnly | boolean | true | Not supported. See notes below. |
tsConfig | string | undefined | Path to typescript configuration file. |
declarationMap | boolean | false | Generate declaration map files. |
printConfig | boolean | false | Print 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
}
},
};