UNPKG

@jazim/plop-install

Version:

Plop generator for installing npm packages

60 lines (43 loc) 1.43 kB
# plop-install A custom action for [Plop.js](https://plopjs.com/) that allows you to install npm packages as part of your generator workflow. ## Installation ```bash npm install -D @jazim/plop-install # or yarn add -D @jazim/plop-install # or pnpm add -D @jazim/plop-install ``` ## Usage Import the action in your `plopfile.js` or `plopfile.ts`: ```typescript import { NodePlopAPI } from "plop"; import { type InstallPackageActionConfig, installPackageAction } from "@jazim/plop-install"; export default function (plop: NodePlopAPI) { plop.setActionType("install-package", installPackageAction); plop.setGenerator("eslint", { description: "Add an eslint", actions: [ { type: "install-package", packages: ["eslint"], options: { dev: true }, } as InstallPackageActionConfig, ], }); } ``` ## Options The `install-package` action accepts the following configuration: | Option | Type | Description | |--------|------|-------------| | `packages` | `string[]` | Array of package names to install | | `options` | `object` | Additional options for installation | | `options.dev` | `boolean` | Install as dev dependency when set to `true` | ## Features - 📦 Install any npm packages during your plop generation - 🛠️ Support for devDependencies - 📋 Works with npm, yarn, and pnpm - 🔄 Seamlessly integrates with your existing plop generators ## License MIT