Plop notes.
npm install @jswork/plop-utils
yarn add dayjs
import { load, metadata } from '@jswork/plop-utils';
// plopfile.js
export default async function (plop) {
await load(plop);
}
// a generator file
export default function (
/** @type {import('plop').NodePlopAPI} */
plop
) {
plop.setGenerator('component', {
description: 'Create a component',
prompts: [
{
type: 'input',
name: 'name',
message: "What is this component's name?"
}
],
actions: [
{
type: 'addMany',
destination: 'src/components/{{ name }}/',
templateFiles: '.templates/component/*.hbs',
data: metadata
}
]
});
}
Code released under the MIT license.