Skip to content

Instantly share code, notes, and snippets.

@jonasmarco
Created June 8, 2021 23:42
Show Gist options
  • Save jonasmarco/26e0c407b4c922e916bfe3de2007767d to your computer and use it in GitHub Desktop.
Save jonasmarco/26e0c407b4c922e916bfe3de2007767d to your computer and use it in GitHub Desktop.
A plop file example
module.exports = (plop) => {
plop.setGenerator('component', {
description: 'Create a component',
prompts: [
{
type: 'input',
name: 'name',
message: 'What is your component name?'
}
],
actions: [
{
type: 'add',
path: '../src/components/{{pascalCase name}}/index.tsx',
templateFile: 'templates/Component.tsx.hbs'
},
{
type: 'add',
path: '../src/components/{{pascalCase name}}/stories.tsx',
templateFile: 'templates/stories.tsx.hbs'
},
{
type: 'add',
path: '../src/components/{{pascalCase name}}/test.tsx',
templateFile: 'templates/test.tsx.hbs'
}
]
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment