Skip to content

Commit

Permalink
Allow concurrency to be configured via package.json (#647)
Browse files Browse the repository at this point in the history
This allows for durable configuration.

May be set globally at the top level, or per-command.

```js
{
    "concurrency": 2,
    "commands": {
        "bootstrap": {
            "concurrency": 8
        }
    }
}
```

As with all options obtained from `Command#getOptions()` a value passed on the
command-line will override configuration from package.json.

```sh
lerna bootstrap --concurrency=4
```
  • Loading branch information
gigabo authored and evocateur committed Mar 7, 2017
1 parent 90e9b30 commit 5f7fbb3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Command.js
Expand Up @@ -17,9 +17,10 @@ export default class Command {
this.logger = logger;
this.repository = new Repository();
this.progressBar = progressBar;
this.concurrency = (!flags || flags.concurrency === undefined) ? DEFAULT_CONCURRENCY : Math.max(1, +flags.concurrency || DEFAULT_CONCURRENCY);

const {sort} = this.getOptions();
const {sort, concurrency} = this.getOptions();

this.concurrency = Math.max(1, +concurrency || DEFAULT_CONCURRENCY);

// If the option isn't present then the default is to sort.
this.toposort = sort == null || sort;
Expand Down

0 comments on commit 5f7fbb3

Please sign in to comment.