diff --git a/ui_framework/generator-kui/component/index.js b/ui_framework/generator-kui/component/index.js index 15ff6cc67a08d..44904c91e91f9 100644 --- a/ui_framework/generator-kui/component/index.js +++ b/ui_framework/generator-kui/component/index.js @@ -27,6 +27,11 @@ module.exports = class extends Generator { default: true, }]).then(answers => { this.config = answers; + + if (!answers.name || !answers.name.trim()) { + this.log.error('Sorry, please run this generator again and provide a component name.'); + process.exit(1); + } }); } @@ -121,7 +126,7 @@ module.exports = class extends Generator { this.log(chalk.white('\n// Import component styles into the root index.scss.')); this.log( - `${chalk.magenta('@import')} ${chalk.cyan(`'./${this.config.name}/index'`)};` + `${chalk.magenta('@import')} ${chalk.cyan(`'${this.config.name}/index'`)};` ); }; diff --git a/ui_framework/generator-kui/component/templates/stateless_function.js b/ui_framework/generator-kui/component/templates/stateless_function.js index f179e04e9cbf4..9f5c28cbd5373 100644 --- a/ui_framework/generator-kui/component/templates/stateless_function.js +++ b/ui_framework/generator-kui/component/templates/stateless_function.js @@ -2,7 +2,11 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -export const <%= componentName %> = ({ children, className, ...rest }) => { +export const <%= componentName %> = ({ + children, + className, + ...rest, +}) => { const classes = classNames('<%= cssClassName %>', className); return ( diff --git a/ui_framework/generator-kui/documentation/templates/documentation_page.js b/ui_framework/generator-kui/documentation/templates/documentation_page.js index 6782b10b23a06..a1b016a5fb0ef 100644 --- a/ui_framework/generator-kui/documentation/templates/documentation_page.js +++ b/ui_framework/generator-kui/documentation/templates/documentation_page.js @@ -3,6 +3,7 @@ import React from 'react'; import { renderToHtml } from '../../services'; import { + GuideCode, GuideDemo, GuidePage, GuideSection, @@ -27,7 +28,7 @@ export default props => ( }]} > - Description needed: how to use the <%= componentExampleName %> component. + Description needed: how to use the <%= componentExampleName %> component.