# Plop

> Micro-generator framework that runs inquirer prompts and Handlebars templates from a plopfile to create consistent files from the terminal.

Stars: 7.7k · Language: JavaScript · License: MIT · Categories: Dev Tools

- Repository: https://github.com/plopjs/plop
- Website: http://plopjs.com
- Page: https://www.trmn.sh/tools/plop

## Install

- npm (project dev dependency): `npm install --save-dev plop`
- npm (global): `npm install -g plop`

## Overview

Plop is a micro-generator framework for creating code or any flat text files in a consistent way. You define generators in a `plopfile` (a Node module that exports a function receiving the `plop` object) using `plop.setGenerator(name, config)`. Each generator has a description, an array of inquirer prompts, and an array of actions, such as an `add` action that renders a Handlebars template to a path like `src/{{name}}.js`. Internally it is glue code between inquirer prompts and Handlebars templates.

From the terminal, running `plop` lists the generators defined in the plopfile (in the current or any parent directory), and `plop [generatorName]` runs one directly. Prompt answers can be bypassed on the command line, either by position (`plop component "my component" react`), by skipping a prompt with `_`, or by name (`plop component -- --name "my component" --type react`). Built-in bypass logic covers standard inquirer prompts such as confirm, list and checkbox. Actions refuse to overwrite existing files by default; the `--force` flag makes all actions run forcefully.

Plopfiles can be written as ESM or CommonJS, and Plop bundles TypeScript declarations. `plop --init-ts` creates a TypeScript plopfile, which runs natively on Node.js v22.18+ and through a tsx loader on older versions. JSDoc type hints are also supported. It is aimed at developers and teams who want to turn their current patterns for routes, components, controllers, helpers or tests into repeatable generators kept in the repository.

### Installation

```bash
# via npm (project dev dependency)
npm install --save-dev plop
```

```bash
# via npm (global)
npm install -g plop
```

## Alternatives

- [np](https://www.trmn.sh/tools/np.md): Interactive release tool for npm packages that checks the working tree, runs tests, bumps versions, creates tags, publishes, and pushes to Git. (JavaScript, 7.7k stars)
- [release-it](https://www.trmn.sh/tools/release-it.md): Generic CLI for automating releases: version bumps, git commit/tag/push, changelogs, GitHub/GitLab releases, and npm publishing, with hooks and plugins. (JavaScript, 9.1k stars)
- [mermaid-cli](https://www.trmn.sh/tools/mermaid-cli.md): Command-line tool (mmdc) that renders Mermaid diagram definitions and Markdown files with Mermaid code blocks to SVG, PNG, or PDF. (JavaScript, 5.2k stars)
- [DocToc](https://www.trmn.sh/tools/doctoc.md): Node.js CLI that generates and updates tables of contents in Markdown files, with anchor links compatible with GitHub, GitLab, Bitbucket, Ghost and nodejs.org. (JavaScript, 4.5k stars)
- [terminalizer](https://www.trmn.sh/tools/terminalizer.md): Terminal session recorder that generates animated GIF images from command-line sessions (JavaScript, 16.2k stars)

---

Canonical: https://www.trmn.sh/tools/plop
