An open API service indexing awesome lists of open source software.

https://github.com/akgondber/post-command-hook-install-packages-plugin


https://github.com/akgondber/post-command-hook-install-packages-plugin

Last synced: 4 months ago
JSON representation

Awesome Lists containing this project

README

        

# post-command-hook-install-packages-plugin [![NPM version][npm-image]][npm-url]

> Install packages plugin for post-command-hook.

Install packages plugin for [post-command-hook](https://www.npmjs.com/package/post-command-hook) gives you a possibility to install specified packages after some command have been executed using the [install-packages](https://github.com/egoist/install-packages) library.

## Installation

```sh
$ npm install --save post-command-hook post-command-hook-install-packages-plugin
```

## Usage

```js
const PostCommandHook = require("post-command-hook");
const InstallPackagesPlugin = require("post-command-hook-install-packages-plugin");

const postCommandHook = new PostCommandHook({
command: "npx",
args: ["create-react-app", "myapp"],
});
postCommandHook.use(new InstallPackagesPlugin(["redux", "react-redux"]));

(async () => {
await postCommandHook.run();
})();
```

## API

### new InstallPackagesPlugin(packages)

Constructs an instance of InstallPackagesPlugin class providing `packages` - an array of packages to be installed.

##### packages

Type: `array`

An array of packages to be installed.

#### installOptions

Type: object

Install options to be passed to [install-packages](https://github.com/egoist/install-packages) module. See [api section in its README](https://github.com/egoist/install-packages#api)

#### pluginOptions

Type: object

Plugin options

##### silent

Type: boolean

If there was an error while installing packages handle it just log it to console without throwing an error

##### name

Type: string

Plugin name to be used when logging error messages, if not specified a random uid will be used as a plugin name

## License

MIT © [Rushan Alyautdinov](https://github.com/akgondber)

[npm-image]: https://img.shields.io/npm/v/post-command-hook-install-packages-plugin.svg?style=flat
[npm-url]: https://npmjs.org/package/post-command-hook-install-packages-plugin