Skip to content

Instantly share code, notes, and snippets.

@ernestofreyreg
Created November 23, 2020 15:59
Show Gist options
  • Save ernestofreyreg/7c57505e4a7ae2d2f63dbc6ba112bbc7 to your computer and use it in GitHub Desktop.
Save ernestofreyreg/7c57505e4a7ae2d2f63dbc6ba112bbc7 to your computer and use it in GitHub Desktop.
import { NodePlopAPI } from 'plop'
export const libGenerator = (plop: NodePlopAPI) => {
const prompts = [
{
type: 'input',
name: 'libName',
message: 'Library name'
},
{
type: 'input',
name: 'description',
message: 'Library description'
}
]
const actions = ({ libName, description }) => {
return [
{
type: 'copy-files',
data: {
source: 'packages/shared/functions',
dest: `packages/shared/${libName}`,
replaceInFiles: {
'@outsrc/functions': `@outsrc/${libName}`,
'Templated shared functions': description
}
}
}
]
}
return {
description: 'Shared Module Generator',
prompts,
actions
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment