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
- Host: GitHub
- URL: https://github.com/akgondber/post-command-hook-install-packages-plugin
- Owner: akgondber
- License: mit
- Created: 2021-11-29T18:54:46.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-09T14:26:46.000Z (about 2 years ago)
- Last Synced: 2025-02-06T04:24:08.824Z (4 months ago)
- Language: JavaScript
- Size: 53.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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