Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to Octane component generators #18275

Closed
chancancode opened this issue Aug 16, 2019 · 1 comment
Closed

Improvements to Octane component generators #18275

chancancode opened this issue Aug 16, 2019 · 1 comment
Assignees
Milestone

Comments

@chancancode
Copy link
Member

Add a Pro Tip™

When invoked with --no-component-class (which is the default in Octane), we should show the following Pro Tip™ at the end of the generator run:

❯❯❯ ember generate component foo
installing component
  create app/components/foo.hbs
installing component-test
  create tests/integration/components/foo-test.js

Tip: run `ember generate component-class foo` if you want to add a class

The exact message is TBD, but this is a perfectly good start.

When invoked with --component-class= set to any other values (whether using that flag or a
related alias/shorthand), the message should not be shown.

New alias, --with-component-class

Add a new alias, --with-component-class, as the "opposite" of --no-component-class.

This is roughly the same as running ember generate component foo && ember generate component-class foo back-to-back, other than that you should not see the Pro Tip™ message.

This flag serves as a way to say "I want a class" without having to think too much about "which one". Pre-Octane, it expands to --component-class=@ember/component. Post-Octane, it expands to --component-class=@glimmer/component.

This is also useful in guides and documentation, where you want to use the more verbose flag for readability, but not as verbose as --component-class=@glimmer/component, which is explicitly drawing attention to the component class multiverse. It's not a bad thing to have choices, but most of the time you shouldn't have to care.

❯❯❯ ember generate component foo --with-component-class
installing component
  create app/components/foo.hbs
installing component-class
  create app/components/foo.js
installing component-test
  create tests/integration/components/foo-test.js

New generator ember generate component-class

Split the class generation part into a separately invokable blueprint/generator, similar to how the component-test blueprint/generator can be invoked separately.

When the component generator is used with any of the --component-class=... other than --no-component-class (directly or through the aliases), the main component generator will delegate to this generator for the class generation, again similar to how component-test generator works.

Because --with-component-class just delegates to this under-the-hood, the have the same default class. Pre-Octane: --component-class=@ember/component. Post-Octane --component-class=@glimmer/component.

This generator should accept most of the same flags that is accepted by the main component generator. For example, and at minimum, it should be possible to call ember generate component-class with the --component-class and --component-structure flags, with the same aliases/shorthands supported by the main generator.

❯❯❯ ember generate component-class foo
installing component-class
  create app/components/foo.js
@chancancode chancancode added this to the 3.14 milestone Aug 16, 2019
@NullVoxPopuli
Copy link
Contributor

dibs (will do after work / if I have a break)

wycats pushed a commit that referenced this issue Sep 17, 2019
As described in #18275.

Closes #18275, #18359.

Co-authored-by: NullVoxPopuli <[email protected]>
chancancode added a commit that referenced this issue Sep 18, 2019
As described in #18275.

Closes #18275, #18359.

Co-authored-by: NullVoxPopuli <[email protected]>
(cherry picked from commit e38c534)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants