Registry / devops / plop-prettier

plop-prettier

JSON →
library3.0.0jsnpmunverified

Plop action type that runs Prettier on files added via plop's add action. Version 3.0.0 requires plop 3.x and Prettier 1.17+. Released intermittently. Differentiator: integrates Prettier formatting directly into plop generators via 'pretty-add' action, reducing boilerplate.

npm install plop-prettier
INSTALL
IMPORT
SIG · PLOP-PRETTIER
P
plop-prettier
devopsjavascriptv3.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plop-prettier
plop.load('plop-prettier')
require('plop-prettier')
Loaded via plop.load, not direct require; used in plopfile.js.
pretty-add action type
type: 'pretty-add'
type: 'prettier' or type: 'plop-prettier'
The action type string is 'pretty-add', not the package name.
options object
plop.load('plop-prettier', { tabWidth: 4 })
plop.load('plop-prettier', { prettier: { tabWidth: 4 } })
Options are passed as a single object directly to plop.load, not nested under a 'prettier' key.

Example plopfile loading plop-prettier and using 'pretty-add' action type to create a component file.

// plopfile.js module.exports = function (plop) { plop.load('plop-prettier', { tabWidth: 4 }); plop.setGenerator('component', { description: 'Create a new component', prompts: [ { type: 'input', name: 'name', message: 'Component name' } ], actions: [ { type: 'pretty-add', path: 'src/{{pascalCase name}}/{{pascalCase name}}.js', template: `import React from 'react'; const {{pascalCase name}} = () => { return <div>{{pascalCase name}}</div>; }; export default {{pascalCase name}};` } ] }); };
Debug
Known issues
breakingplop-prettier 3.x requires plop 3.x; not compatible with plop 2.x.
fix
Upgrade plop to version 3 or higher.
affects: >=3.0.0
breakingStyle of pass options changed from nested to flat object in v3.
fix
Pass options directly: plop.load('plop-prettier', { tabWidth: 4 }) instead of plop.load('plop-prettier', { prettier: { tabWidth: 4 } })
affects: >=3.0.0
gotchaAction type 'pretty-add' is not 'prettier-add' or 'prettyadd'.
fix
Use exactly 'pretty-add' as the action type.
affects: >=1.0.0
gotchaThe 'pretty-add' action only runs Prettier on the content; it does not auto-format existing files.
fix
Use a separate prettier script or hook to format existing files.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'prettier'
Missing peer dependency 'prettier'
fix
npm install prettier
TypeError: plop.load is not a function
Trying to run plop.load in a context where plop is not the plop API object
fix
Ensure plop.load is called inside the plopfile export function: module.exports = function(plop) { plop.load('plop-prettier'); }
Unrecognized action type: prettier-add
Using wrong action type string
fix
Use 'pretty-add' (with underscore, not hyphen).
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
prettierrequiredpeer dependency required for formatting
Agent activity
4 hits · last 30 days
node
4
Resources
plop-prettier — npm install plop-prettier · libregistry