Skip to content

Commit

Permalink
Merge pull request #112 from IgnusG/concurrency
Browse files Browse the repository at this point in the history
Add concurrency "toggle"
  • Loading branch information
theenadayalank authored Apr 15, 2020
2 parents d6ead8f + bfbe4a6 commit b987e28
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ The above scrips will lint the js files while pushing to git. It will terminate
### With Errors
<img src="screenshots/OutputWithErrors.gif" width="496" height="340" alt="With Erros">

### Concurrent Tasks

Tasks for a file group will by default run in linear order (eg. `"*.js": [ "jest", "eslint"]` will run jest first, then after it's done run eslint).
If you'd like to run tasks for a file group concurrently instead (eg. jest and eslint in parallel), use the `concurrent` property like so:

```diff
{
+ "lint-prepush": {
+ "tasks": {
+ "*.js": {
+ concurrent: [ "jest", "eslint" ]
+ }
+ }
+ }
}
```

## Built With

* [NodeJs](https://nodejs.org/en/) - Framework used
Expand Down
4 changes: 2 additions & 2 deletions utils/resolveMainTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ module.exports = function resolveMainTask( options = {} ) {
return constructTaskList(options).map(task => ({
title: `Linting ${task.fileFormat} files`,
task: () =>
new Listr(resolveLintTask(task.commandList, task.fileList), {
new Listr(resolveLintTask(task.commandList.concurrent || task.commandList, task.fileList), {
exitOnError: true,
concurrent: false
concurrent: Array.isArray(task.commandList.concurrent)
}),
skip: () => {
if (task.fileList.length === 0) {
Expand Down

0 comments on commit b987e28

Please sign in to comment.