Plop

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

install

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

# via npm (project dev dependency)
npm install --save-dev plop
# via npm (global)
npm install -g plop

Alternatives & related tools

add a badge to your README

Maintain Plop? Show that it's featured on trmn. The badge links back to this page.

Featured on trmn
Markdown
[![Featured on trmn](https://www.trmn.sh/badge/plop.svg)](https://www.trmn.sh/tools/plop?utm_source=badge)
HTML
<a href="https://www.trmn.sh/tools/plop?utm_source=badge"><img src="https://www.trmn.sh/badge/plop.svg" alt="Featured on trmn" height="20"></a>