cra-template-rb
Version:
The official React Boilerplate template for Create React App
19 lines (16 loc) • 580 B
text/typescript
import { NodePlopAPI } from 'node-plop';
import { componentGenerator } from './component';
import shell from 'shelljs';
import { sliceGenerator } from './slice';
interface PrettifyCustomActionData {
path: string;
}
export default function plop(plop: NodePlopAPI) {
plop.setGenerator('component', componentGenerator);
plop.setGenerator('slice', sliceGenerator);
plop.setActionType('prettify', (answers, config) => {
const data = config!.data as PrettifyCustomActionData;
shell.exec(`yarn run prettify -- "${data.path}"`, { silent: true });
return '';
});
}