Skip to content

Instantly share code, notes, and snippets.

@amaankulshreshtha
Created February 3, 2020 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amaankulshreshtha/6e751d4d0e40b33d18aee9693b588f52 to your computer and use it in GitHub Desktop.
Save amaankulshreshtha/6e751d4d0e40b33d18aee9693b588f52 to your computer and use it in GitHub Desktop.
import { AddActionConfig, NodePlopAPI } from 'plop';
export default function(plop: NodePlopAPI) {
plop.setGenerator('common', {
description: 'add a common component',
prompts: [
{
type: 'input',
name: 'name',
message: 'common component name please'
}
],
actions: [
{
type: 'add',
path: 'common/{{pascalCase name}}/index.js',
templateFile: 'plop-templates/ReactComponents/index.hbs'
},
{
type: 'add',
path: 'common/{{pascalCase name}}/index.styles.js',
templateFile: 'plop-templates/ReactComponents/index.styles.hbs'
}
] as Array<AddActionConfig>
});
plop.setGenerator('components', {
description: 'add a smart component',
prompts: [
{
type: 'input',
name: 'name',
message: 'smart component name please'
}
],
actions: [
{
type: 'add',
path: 'components/{{pascalCase name}}/index.js',
templateFile: 'plop-templates/ReactComponents/index.hbs'
},
{
type: 'add',
path: 'components/{{pascalCase name}}/index.styles.js',
templateFile: 'plop-templates/ReactComponents/index.styles.hbs'
}
] as Array<AddActionConfig>
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment