# rollup-plugin-command

> Run commands and call functions when bundles are generated

Latest version **1.1.3** (published 2020-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install rollup-plugin-command
pnpm add rollup-plugin-command
yarn add rollup-plugin-command
bun add rollup-plugin-command
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2020-06-08 |
| First published | 2019-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 53.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Maintainers | vehmloewff |

## Links

- npm: https://www.npmjs.com/package/rollup-plugin-command
- Repository: https://github.com/Vehmloewff/rollup-plugin-command
- Homepage: https://github.com/Vehmloewff/rollup-plugin-command#readme
- Issues: https://github.com/Vehmloewff/rollup-plugin-command/issues
- npm.io page: https://npm.io/package/rollup-plugin-command

## Recent versions

- 1.1.3 (latest) — 2020-06-08
- 1.1.2 — 2020-01-03
- 1.1.1 — 2019-12-26
- 1.1.0 — 2019-12-26
- 1.0.7 — 2019-11-06
- 1.0.6 — 2019-11-06
- 1.0.5 — 2019-11-06
- 1.0.4 — 2019-11-06
- 1.0.3 — 2019-11-06
- 1.0.2 — 2019-11-06
- 1.0.1 — 2019-11-06
- 1.0.0 — 2019-11-06

## README

# rollup-plugin-command

Run commands and call functions when bundles are generated

## Installation

```sh
npm i -D rollup-plugin-command
```

## Usage

```js
// rollup.config.js
import command from 'rollup-plugin-command';

export default {
	// ...
	plugins: [
		// ...
		command(`node tests.js`, options),
	],
	// ...
};
```

The [options](#options) are, of course, optional.

```js
command(require('tests.js'));
```

```js
command(
	[
		`npm test`, // The next command will not be executed until this
		// one is finished.

		require('./scripts/cleanup').someFunc, // If this returns a
		// promise, and `options.wait` is true (it's false by default), this
		// plugin will wait for it to be resolved before moving on to the
		// next command or finishing the build.
	],
	{ exitOnFail: true }
); // Default for options.exitOnFail is false.
```

### options

```ts
interface CommandOptions {
	exitOnFail?: boolean; // (Only applies when one of the given commands
	// is a string) Exit the current process when the child process fails.
	// Default is false.

	once?: boolean; // (Only valid when rollup is in watch mode) If the
	// commands should be executed only the first time a bundle is built.
	// Default is false.

	wait?: boolean; // If the the build should wait for the commands to
	// be executed.  Default is false.
}
```

I hope you find this package usefull!

## License

[MIT](/LICENSE)

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