Ui/fix component story generators (#7377)
* remove ember-cli-valid-component-name since we no longer need it * component names no longer need to contain a hyphen * remove Husky from README since we no longer use it * update Storybook example * update JSDoc examples and fix params table header
This commit is contained in:
parent
716f25162a
commit
d52d324df4
16
ui/README.md
16
ui/README.md
|
@ -15,6 +15,8 @@
|
|||
- [Storybook Commands at a Glance](#storybook-commands-at-a-glance)
|
||||
- [Writing Stories](#writing-stories)
|
||||
- [Adding a new story](#adding-a-new-story)
|
||||
- [Code Generators](#code-generators-1)
|
||||
- [Further Reading / Useful Links](#further-reading--useful-links)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
|
@ -30,12 +32,10 @@ You will need the following things properly installed on your computer.
|
|||
- [Yarn](https://yarnpkg.com/en/)
|
||||
- [Git](https://git-scm.com/)
|
||||
- [Ember CLI](https://ember-cli.com/)
|
||||
- [Husky\*](https://github.com/typicode/husky)
|
||||
- [lint-staged\*](https://www.npmjs.com/package/lint-staged)
|
||||
|
||||
\* Husky and lint-staged are optional dependencies - running `yarn` will install them.
|
||||
If don't want them installed (husky adds files for every hooks in `.git/hooks/`),
|
||||
then you can run `yarn --ignore-optional`. If you've ignored the optional deps
|
||||
\* lint-staged is an optional dependency - running `yarn` will install it.
|
||||
If don't want optional dependencies installed you can run `yarn --ignore-optional`. If you've ignored the optional deps
|
||||
previously and want to install them, you have to tell yarn to refetch all deps by
|
||||
running `yarn --force`.
|
||||
|
||||
|
@ -143,10 +143,10 @@ Each component in `vault/ui/app/components` should have a corresponding `[compon
|
|||
* {{/if}}
|
||||
* ```
|
||||
*
|
||||
* @param toggleAttr=null {String} - The attribute upon which to toggle.
|
||||
* @param attrTarget=null {Object} - The target upon which the event handler should be added.
|
||||
* @param [openLabel=Hide options] {String} - The message to display when the toggle is open. //optional params are denoted by square brackets
|
||||
* @param [closedLabel=More options] {String} - The message to display when the toggle is closed.
|
||||
* @param {String} toggleAttr=null - The attribute upon which to toggle.
|
||||
* @param {Object} attrTarget=null - The target upon which the event handler should be added.
|
||||
* @param {String} [openLabel=Hide options] - The message to display when the toggle is open. //optional params are denoted by square brackets
|
||||
* @param {String} [closedLabel=More options] - The message to display when the toggle is closed.
|
||||
*/
|
||||
````
|
||||
Note that placing a param inside brackets (e.g. `[closedLabel=More options]` indicates it is optional and has a default value of `'More options'`.)
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
/**
|
||||
* @module <%= classifiedModuleName %>
|
||||
* <%= classifiedModuleName %> components are used to...
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* <<%= classifiedModuleName %> @param1={param1} @param2={param2} />
|
||||
* <<%= classifiedModuleName %> @requiredParam={requiredParam} @optionalParam={optionalParam} @param1={{param1}}/>
|
||||
* ```
|
||||
*
|
||||
* @param param1 {String} - param1 is...
|
||||
* @param [param2=value] {String} - param2 is... //brackets mean it is optional and = sets the default value
|
||||
* @param {object} requiredParam - requiredParam is...
|
||||
* @param {string} [optionalParam] - optionalParam is...
|
||||
* @param {string} [param1=defaultValue] - param1 is...
|
||||
*/
|
||||
import Component from '@ember/component';
|
||||
|
||||
import Component from '@ember/component';
|
||||
<%= importTemplate %>
|
||||
export default Component.extend({<%= contents %>
|
||||
});
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
const path = require('path');
|
||||
const stringUtil = require('ember-cli-string-utils');
|
||||
const pathUtil = require('ember-cli-path-utils');
|
||||
const validComponentName = require('ember-cli-valid-component-name');
|
||||
const getPathOption = require('ember-cli-get-component-path-option');
|
||||
const normalizeEntityName = require('ember-cli-normalize-entity-name');
|
||||
|
||||
module.exports = {
|
||||
description: 'Generates a component. Name must contain a hyphen.',
|
||||
description: 'Generates a component.',
|
||||
|
||||
availableOptions: [
|
||||
{
|
||||
|
@ -50,9 +49,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
normalizeEntityName: function(entityName) {
|
||||
entityName = normalizeEntityName(entityName);
|
||||
|
||||
return validComponentName(entityName);
|
||||
return normalizeEntityName(entityName);
|
||||
},
|
||||
|
||||
locals: function(options) {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
{{>description~}}
|
||||
|
||||
**Params**
|
||||
{{>params~}}
|
||||
|
||||
{{>properties~}}
|
||||
|
|
Loading…
Reference in New Issue