nucleus-ui-builder
Version:
79 lines (78 loc) • 2.64 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return CommandScaffold;
}
});
const _commandschemabuilder = /*#__PURE__*/ _interop_require_default(require("../builder/command.schema.builder.js"));
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;
}
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
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.default().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`
});
}
}
//# sourceMappingURL=command.scaffold.js.map