module.exports = plop => {
  plop.setGenerator('component', {
    description: 'Creates a component.',
    prompts: [
      {
        name: 'name',
        message: 'Enter the component name.',
        validate: name => {
          if (name.trim().length < 1) {
            return 'Name is required.'
          }
          return true
        },
      },
      {
        name: 'description',
        message: 'Describe your component.',
      },
    ],
    actions: [
      {
        type: 'addMany',
        templateFiles: 'plop/templates/react-common/component/*',
        base: 'plop/templates/react-common/component',
        destination: 'packages/react-common/src/components/{{pascalCase name}}',
      },
      {
        type: 'addMany',
        templateFiles: 'plop/templates/react-common-docs/component/*',
        base: 'plop/templates/react-common-docs/component',
        destination: 'packages/react-common-docs/src/pages/components',
      },
    ],
  })
}
