lukeed / taskr

A fast, concurrency-focused task automation tool.
MIT License
2.53k stars 75 forks source link

@taskr/typescript support for tsconfig.json #309

Open mtoso opened 6 years ago

mtoso commented 6 years ago

Hi, thanks for this project. I was wondering if there is a way to use the options for the typescript compiler coming from the tsconfig.json.

lukeed commented 6 years ago

Hey, thanks~! Right now the plugin is only expecting programmatic options, which correlate to the Compiler Options.

If you wanted to use an existing tsconfig.json file, you can parse it at the beginning of your TS task and send along the right pieces.

export async function scripts(task) {
  let data = require('./tsconfig');
  // If using tsconfig for "source" you must handle that on your own
  let files = data.files.map(handler) || 'src/**/*.ts';
  await task.source(files).typescript(data.compilerOptions).target('...');
}