# commands-queue

> execute command line in a queue

Latest version **0.0.3** (published 2018-09-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install commands-queue
pnpm add commands-queue
yarn add commands-queue
bun add commands-queue
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2018-09-17 |
| First published | 2018-09-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 11.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sebastian Gurin |
| Maintainers | cancerberosgx |

## Links

- npm: https://www.npmjs.com/package/commands-queue
- npm.io page: https://npm.io/package/commands-queue

## Dependencies (2)

- [p-queue](https://npm.io/package/p-queue.md) ^3.0.0
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.2

## Recent versions

- 0.0.3 (latest) — 2018-09-17
- 0.0.2 — 2018-09-17
- 0.0.1 — 2018-09-17

## README

# commands-queue

**execute command line in a synchronized fashion**

 * concurrently
 * in a concurrent sized queue
 * serially

```sh
npm install --save commands-queue
```

The following example execute all given commands in a concurrent queue of size 2:

```js
const CommandQueue = require('commands-queue')
const queue = new CommandQueue({concurrency: 2})
queue.exec('cd project1 && npm install && npm run build && npm test')
queue.exec('cd project2 && npm install && npm run build && npm test')
queue.exec('cd project3 && npm install && npm run build && npm test').then(result=>console.log('echo "almost there", exit code: '+result.code))
queue.exec('cd project4 && npm install && npm run build && npm test')
```

Or similar to above but this time registering all the commands first and then start executing them programmatically:

(TODO)


```js
const CommandQueue = require('commands-queue')
const queue = new CommandQueue({concurrency: 2, autoStart: false})
queue.exec('cd project1 && npm install && npm run build && npm test')
queue.exec('cd project2 && npm install && npm run build && npm test')
queue.exec('cd project3 && npm install && npm run build && npm test').then(console.log('echo "almost there"'))
queue.exec('cd project4 && npm install && npm run build && npm test')
queue.onIdle().then(()=>console.log('ALL WORK DONE'))
const results = await queue.start()
```

# Documentation

[API docs](https://cancerberosgx.github.io/commands-queue/index.html)

---
_Source: https://npm.io/package/commands-queue · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
