Nx: NX does not ask for routing options when generating app or lib

Created on 20 Mar 2019  ยท  6Comments  ยท  Source: nrwl/nx

Prerequisites

  • [x] I am running the latest version
  • [x] I checked the documentation and found no answer
  • [x] I checked to make sure that this issue has not already been filed
  • [x] I'm reporting the issue to the correct repository (not related to Angular, AngularCLI or any dependency)

Expected Behavior

When generating applications or libraries from a command line NX should prompt for routing options.

Current Behavior

NX does not prompt for routing options when generating Angular app or lib. No routing is implied.

Providing routing options as arguments to ng generate produces correct result. Meaning running something like ng g lib mylib --routing --lazy --parent-module=apps/myapp/src/app/app.module.ts works as expected.

Failure Information (for bugs)

Running ng generate application or ng generate library from a command line doesn't prompt for routing options.

Steps to Reproduce

Run ng generate application or ng generate library inside an NX workspace.
No routing related questions are asked.

Context

Please provide any relevant information about your setup:

  • version of Nx used: 7.7.2
  • version of Angular CLI used: 7.3.6

Most helpful comment

Reasoning behind removing --routing.

We are trying to minimize the number of options prompted when generating a lib or an app. I'd like it to be only the things you must provision when creating things, the things that are very hard to correct after they have been generated. For instance, you don't provision the right directory, you will have to move the generated files, update tsconfigs and other configuration files. It's hard to get right.

Most libs in our internal and external projects don't export any routes. This is at least partially due to the same library schematic generating typescript and angular libs. We are in the process of separating those out, which will make having separate defaults for angular and typescript libs possible. This work should be done by mid May.

To sum up:
In the current setup, prompting users to configure the router doesn't seem the most ergonomic setup. So we decided to change the prompt configuration until we have a way to provision separate defaults for angular and typescript libs.

All 6 comments

@elishnevsky I tested with the last version of Nx, and the routing option is present:

Nx-Routing-Prompt

@vsavkin @FrozenPandaz This issue can be closed.

Didn't ask me when I tried generating an application.

@elishnevsky I already tested generating a dummy app:

I tested with the following versions of nx:

  1. @nrwl/[email protected]
    Generating App.

  2. @nrwl/[email protected]

Please check the version of nx installed using npm list -g @nrwl/schematics and upgrade to the latest.
Nx-Generate-App2

Forgot to mention that I'm on Windows 10. This still doesn't work. Neither when generating an app nor a lib.

@SebasG22 it appears from your capture you may not actually be using 7.8.0 even though it is installed globally. The app cinema-bg may have been created using an earlier version of @nrwl/schematics? My reasoning is when using @nrwl/[email protected] your first prompt should be:

? What framework would you like to use for the application? (Use arrow keys)
โฏ Angular [ https://angular.io ]
React [ https://reactjs.org/ ]
Web Components

@elishnevsky I was able to get routing prompts back if I downgraded from 7.8.0 to 7.6.0, this was the latest working version for me.

Looks like it may be a regression introduced in 7.7.0 possibly here => https://github.com/nrwl/nx/commit/9ef7606b3ed83d5e92d9ceb0fd065b2bf81a51bc?diff=unified#diff-dd9e54e72ff5d231c2bf1d431e61f1c0 on line 66 where x-prompt was removed. @vsavkin would you mind sharing the reasoning for this, please?

Reasoning behind removing --routing.

We are trying to minimize the number of options prompted when generating a lib or an app. I'd like it to be only the things you must provision when creating things, the things that are very hard to correct after they have been generated. For instance, you don't provision the right directory, you will have to move the generated files, update tsconfigs and other configuration files. It's hard to get right.

Most libs in our internal and external projects don't export any routes. This is at least partially due to the same library schematic generating typescript and angular libs. We are in the process of separating those out, which will make having separate defaults for angular and typescript libs possible. This work should be done by mid May.

To sum up:
In the current setup, prompting users to configure the router doesn't seem the most ergonomic setup. So we decided to change the prompt configuration until we have a way to provision separate defaults for angular and typescript libs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

about-code picture about-code  ยท  3Comments

joelmuskwe picture joelmuskwe  ยท  3Comments

danieldanielecki picture danieldanielecki  ยท  3Comments

kmkatsma picture kmkatsma  ยท  3Comments

markphip picture markphip  ยท  3Comments