UNPKG

@naoufal/create-react-component

Version:
29 lines (21 loc) 819 B
#!/usr/bin/env node const command = require('commander'); const { interactive } = require('./interactive'); function main() { command .version(require('../package.json').version) .option('-p --path <componentPath>') .option('-t --template <selectedTemplate>') // name of package .option('-y --type <componentType>') // function, class, es6 .option('-n --name <componentName>') .parse(process.argv); const { componentName, componentPath, componentType, selectedTemplate } = command; const skipInteractive = componentName && componentPath && componentType && selectedTemplate; if (skipInteractive) { // TODO: // - Check that all options are valid return execution({ componentName, componentPath, componentType, selectedTemplate }); } interactive(command); } main();