@gnoesiboe/run-concurrently
Version:
Command line tool to use 'concurrently' with a JSON configuration, to make it more readable and easier to manage.
29 lines (22 loc) • 729 B
JavaScript
exports.convertTaskConfigurationToConcurrentlyArguments = function (
configForTask
) {
const { determineColorForIndex } = require('./colorHelper');
const commands = configForTask.subTasks.map(
({ workingDirectory, name, command }, index) => {
command = workingDirectory
? `cd ${workingDirectory} && ${command}`
: command;
const prefixColor = `${determineColorForIndex(index)}.bold`;
return { command, name, prefixColor };
}
);
const DEFAULT_OPTIONS = {
killOthers: ['failure'],
};
const options = {
...DEFAULT_OPTIONS,
...configForTask.options,
};
return [commands, options];
};