ember-cli-typescript
ember-cli-typescript copied to clipboard
Parity with Octane's glimmer component generation options
As an Ember application developer, I want parity between the ember generate component classic vs. octane/glimmer options when using "vanilla ember" or ember-cli-typescript so that I do not have to mentally keep track of two separate APIs for the same thing.
For example, I would like to be able to run ember g component with --component-class/-gc/-cc, --component-structure when using ember-cli-typescript just like I can when not using it.
Default
$ ember generate component --help
Requested ember-cli commands:
ember generate <blueprint> <options...>
Generates new code from blueprints.
aliases: g
--dry-run (Boolean) (Default: false)
aliases: -d
--verbose (Boolean) (Default: false)
aliases: -v
--pod (Boolean) (Default: false)
aliases: -p, -pods
--classic (Boolean) (Default: false)
aliases: -c
--dummy (Boolean) (Default: false)
aliases: -dum, -id
--in-repo-addon (String) (Default: null)
aliases: --in-repo <value>, -ir <value>
--in (String) (Default: null) Runs a blueprint against an in repo addon. A path is expected, relative to the root of the project.
component <name> <options...>
Generates a component.
--path (String) (Default: components)
aliases: --no-path (--path="")
--component-class (@ember/component, @glimmer/component, @ember/component/template-only, "") (Default: --no-component-class)
aliases: -cc (--component-class=@ember/component), -gc (--component-class=@glimmer/component), -tc (--component-class=@ember/component/template-only), -nc (--component-class=""), --no-component-class (--component-class=""), --with-component-class (--component-class=@glimmer/component)
--component-structure (flat, nested, classic) (Default: flat)
aliases: -fs (--component-structure=flat), -ns (--component-structure=nested), -cs (--component-structure=classic)
With ember-cli-typescript
$ ember generate component --help
Requested ember-cli commands:
ember generate <blueprint> <options...>
Generates new code from blueprints.
aliases: g
--dry-run (Boolean) (Default: false)
aliases: -d
--verbose (Boolean) (Default: false)
aliases: -v
--pod (Boolean) (Default: false)
aliases: -p, -pods
--classic (Boolean) (Default: false)
aliases: -c
--dummy (Boolean) (Default: false)
aliases: -dum, -id
--in-repo-addon (String) (Default: null)
aliases: --in-repo <value>, -ir <value>
--in (String) (Default: null) Runs a blueprint against an in repo addon. A path is expected, relative to the root of the project.
component <name> <options...>
Generates a component.
--path (String) (Default: components)
aliases: --no-path (--path="")
$ ember -v
ember-cli: 3.15.1
node: 12.14.0
os: linux x64
$ grep typescript package.json
"ember-cli-typescript": "^3.1.2",
"ember-cli-typescript-blueprints": "^3.0.0",
"typescript": "^3.7.4"
Some different but possibly related issues:
- https://github.com/typed-ember/ember-cli-typescript/issues/930
- https://github.com/typed-ember/ember-cli-typescript/issues/966
- https://github.com/typed-ember/ember-cli-typescript/issues/364#issuecomment-527452935
Yep, we can recommend as a workaround for now just uninstalling the blueprints. There's a lot broken there and unfortunately none of us has had time to go and fix.
@chriskrycho Assuming no one has had time to work on this yet, could you confirm that all that's needed to uninstall the blueprints is to manually remove ember-cli-typescript-blueprints from package.json's devDependencies (installed by ember install ember-cli-typescript)? (That seems to work.)
That’s correct! And yeah, we haven’t had time to get around to updating these yet (though it’s on my radar, and I may start chipping away at it as soon as late this week).
I will put this here so that folks have a chance to Google for this issue: After you install ember-cli-typescript, you will get all sorts of warnings when generating components:
❯ ember g component foo/bar --component-structure=nested
The option '--component-structure' is not registered with the 'generate' command. Run `ember generate --help` for a list of supported options.
Or:
❯ ember g component foo/bar -gc
The option '--gc' is not registered with the 'generate' command. Run `ember generate --help` for a list of supported options.
This issue should track some progress on fixing this.
Thank you, @MichalBryxi! For anyone following this thread: you should expect to see an Ember RFC tackling this problem in a very general way (not specific to TS, but solving the problem for us as well!) in the next few weeks—maybe by Thanksgiving, or maybe shortly after. 🤞🏼
Resolved by Ember shipping native TS blueprints. 🎉