зеркало из https://github.com/microsoft/just.git
check for options project before running
This commit is contained in:
Родитель
d37fcec1f5
Коммит
cb42a0b46d
|
@ -0,0 +1,7 @@
|
|||
const { task, parallel } = require('just-task');
|
||||
const { tscTask } = require('../lib/tscTask');
|
||||
|
||||
//task('build', parallel(tscTask(), tscTask()));
|
||||
task('ts', tscTask());
|
||||
|
||||
task('build', parallel('ts'));
|
|
@ -11,11 +11,17 @@ interface Arguments {
|
|||
[key: string]: string;
|
||||
}
|
||||
|
||||
export function tscTask(getOptions: (argv: Arguments) => ts.CompilerOptions | ts.CompilerOptions) {
|
||||
return function(this: { logger: ILogger; argv: Arguments }, done: (err?: Error) => void) {
|
||||
const options = typeof getOptions === 'function' ? getOptions(this.argv) : getOptions;
|
||||
type GetOptions = ts.CompilerOptions | ((test: Arguments) => ts.CompilerOptions);
|
||||
|
||||
this.logger.info(`Running ${tscCmd} with ${options.project}`);
|
||||
export function tscTask(getOptions: GetOptions) {
|
||||
return function tsc(this: { logger: ILogger; argv: Arguments }, done: (err?: Error) => void) {
|
||||
const options = (typeof getOptions === 'function' ? getOptions(this.argv) : getOptions) || {};
|
||||
|
||||
if (options.project) {
|
||||
this.logger.info(`Running ${tscCmd} with ${options.project}`);
|
||||
} else {
|
||||
this.logger.info(`Running ${tscCmd}`);
|
||||
}
|
||||
|
||||
const args = Object.keys(options).reduce(
|
||||
(args, option) => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче