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

ng help generators doesn't explain how to use generators #8266

Closed
leff opened this issue Oct 31, 2017 · 3 comments
Closed

ng help generators doesn't explain how to use generators #8266

leff opened this issue Oct 31, 2017 · 3 comments
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix

Comments

@leff
Copy link

leff commented Oct 31, 2017

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.4.9
node: 7.10.1
os: darwin x64
@angular/animations: 4.4.6
@angular/common: 4.4.6
@angular/compiler: 4.4.6
@angular/core: 4.4.6
@angular/forms: 4.4.6
@angular/http: 4.4.6
@angular/platform-browser: 4.4.6
@angular/platform-browser-dynamic: 4.4.6
@angular/router: 4.4.6
@angular/cli: 1.4.9
@angular/compiler-cli: 4.4.6
@angular/language-service: 4.4.6
typescript: 2.3.4

Repro steps.

  1. Type ng help generators

The log given by the failure.

Output:

Available schematics:
    application
    class
    component
    directive
    enum
    guard
    interface
    module
    pipe
    service

ng generate <schematic> <options...>
  Generates and/or modifies files based on a schematic.
  aliases: g
  --dry-run (Boolean) (Default: false) Run through without making any changes.
    aliases: -d, --dryRun
  --force (Boolean) (Default: false) Forces overwriting of files.
    aliases: -f, --force
  --app (String) Specifies app name to use.
    aliases: -a <value>, -app <value>
  --collection (String) Schematics collection to use.
    aliases: -c <value>, --collection <value>
  --lint-fix (Boolean) Use lint to fix files after generation.
    aliases: -lf, --lintFix

This is apparently how to use the generators:

ng generate <schematic> <options...>

The problem is, that <options...> is undefined.

What is really needed is a module name, but it looks like all the --<options> are the options.

If you fail to enter a module name the output looks like this:

$ ng generate component
Cannot read property 'split' of undefined
TypeError: Cannot read property 'split' of undefined
    at Class.run (/Users/jasonb/telnyx/semantic-ui-test/node_modules/@angular/cli/commands/generate.js:109:63)
    at resolve (/Users/jasonb/telnyx/semantic-ui-test/node_modules/@angular/cli/ember-cli/lib/models/command.js:261:20)
    at Class.validateAndRun (/Users/jasonb/telnyx/semantic-ui-test/node_modules/@angular/cli/ember-cli/lib/models/command.js:240:12)
    at Promise.resolve.then.then (/Users/jasonb/telnyx/semantic-ui-test/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:140:24)

Of course, none of the listed options will help on their own. You need to give it a name.

Desired functionality.

  1. Rewrite the ng help generators text to show that you need to provide a name.
  2. Fix the generators themselves to give better error messages.

Mention any other details that might be useful.

@filipesilva filipesilva added P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix labels Nov 2, 2017
@filipesilva
Copy link
Contributor

I think @Brocco was fixing this in #8255. Can you confirm @Brocco ?

@hansl hansl unassigned Brocco Feb 6, 2018
@alan-agius4
Copy link
Collaborator

Closing as this has been addressed in version 7 RC 2.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix
Projects
None yet
Development

No branches or pull requests

4 participants