@mongez/gnz
Version:
Generator Z, the next generation of scaffolding tools.
17 lines (16 loc) • 955 B
JavaScript
import {Command}from'commander';import path from'path';import {generateReactComponent}from'../../index.js';import {gnz}from'../../../../main.js';const newReactComponentCommand = new Command("react:component")
.arguments("<name>")
.option("-p, --path <path>", "Path to save the component to")
.option("-m, --memo <memo>", "Whether to use memo or not")
.option("-f, --ref <forwardRef>", "Whether to use forwardRef or not")
.option("-i, --index <withIndex>", "Whether to generate an index file or not")
.action(async (name, options) => {
const { memo, ref, index, path: path$1 } = options;
await gnz.execute(generateReactComponent.execute({
name,
saveTo: path.resolve(process.cwd(), path$1 || ""),
forwardRef: ref && ref !== "false",
memo: memo !== "false",
withIndex: index !== "false",
}));
});export{newReactComponentCommand};//# sourceMappingURL=newReactComponentCommand.js.map