UNPKG

nucleus-ui-builder

Version:
65 lines (64 loc) 2.3 kB
function _define_property(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } import CommandSchemaBuilder from "../builder/command.schema.builder.js"; class CommandScaffold { builder(cli) { const schema = this.schema.build(); Object.entries(schema.positional).forEach(([name, config])=>{ cli.positional(name, config); }); Object.entries(schema.options).forEach(([name, config])=>{ cli.option(name, config); }); return cli; } handler(argv) { this.processor.execute(argv); } constructor(processor){ _define_property(this, "processor", void 0); _define_property(this, "command", void 0); _define_property(this, "describe", void 0); _define_property(this, "schema", void 0); this.processor = processor; this.command = `scaffold <templateName> <componentName> in <category> [subcategory] [extensions]`; this.describe = `Scaffold a new component using a predefined template`; this.schema = new CommandSchemaBuilder().addPositional(`templateName`, { alias: `t`, describe: `Template name (e.g., component, hook, page)`, type: `string`, demandOption: true }).addPositional(`componentName`, { alias: `component`, describe: `Template name (e.g., Input, Button)`, type: `string`, demandOption: true }).addPositional(`category`, { alias: `c`, describe: `Category where the component will be placed`, type: `string`, demandOption: true }).addPositional(`subcategory`, { alias: `s`, describe: `Optional subdirectory inside the category`, type: `string` }).addOption(`extensions`, { alias: `e`, describe: `Comma-separated list of extensions (e.g., jest,storybook)`, type: `string` }); } } export { CommandScaffold as default }; //# sourceMappingURL=command.scaffold.js.map