nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.67k stars 2.36k forks source link

adding gateway produces malformed file name #4130

Closed nhhockeyplayer closed 3 years ago

nhhockeyplayer commented 3 years ago

I thought the schematic could be a little more intuitive and coaching when fields are omitted to allow it to ask/pick

Im just feeling out where it will go

and this is where it went for this instance

  1. I created a workspace named portal
  2. I installed all relevant packages that would be needed for this to complete using YARN
  3. I generated a front end APP named dashboard. nx g @nrwl/angular:app
  4. I generated a back end Nest APP named micro-root nx generate @nrwl/nest:app micro-root --frontend-project dashboard

all is well from here builds runs fine

this is where the issue arises

nx generate @nrwl/nest:gateway

I had hoped the schematicx would prompt me but it didnt and bypassed dry-run and populated the following file into the micro-root project

-dry-run.gateway.ts
import { SubscribeMessage, WebSocketGateway } from '@nestjs/websockets';

@WebSocketGateway()
export class –dryRunGateway {
  @SubscribeMessage('message')
  handleMessage(client: any, payload: any): string {
    return 'Hello world!';
  }
}
mandarini commented 3 years ago

Hi there @nhhockeyplayer ! Thanks for filing an issue!

I could not reproduce your issue, unfortunately... :(

Screenshot 2020-11-24 at 1 06 33 PM

When I run the nx generate @nrwl/nest:gateway schematic, I get prompted to provide a name.

Screenshot 2020-11-24 at 1 07 25 PM

It also works fine with the --dry-run flag.

I thought that maybe you missed something, and you accidentally provided --dry-run as the name for the gateway. So, I tried to reproduce your case by providing as the name of the gateway a number of combinations like -dry-run, --dry-run, --dryRun, -dryRun, ---dry-run. With -dry-run provided as name I did get the -dry-run.gateway.ts, but none of my combinations/trials produced a class name with a dash at the front (–dryRunGateway).

Screenshot 2020-11-24 at 1 10 29 PM Screenshot 2020-11-24 at 1 10 39 PM

Let me see how I can help:

  1. Can you please try it once more, maybe with the latest version of Nx, and let me know where it failed?
  2. Can you please let me know what steps you followed to create your nx workspace? a. Run npx create-nx-workspace@latest portal b. Choose angular [a workspace with a single Angular application] Screenshot 2020-11-24 at 1 13 52 PM
    or did you choose `angular-nest      [a workspace with a full stack application (Angular + Nest)]`
    <img width="678" alt="Screenshot 2020-11-24 at 1 14 27 PM" src="https://user-images.githubusercontent.com/6603745/100087171-fbb5e880-2e56-11eb-910c-1f522f064fbf.png">
    (not much of a difference there, I just want to make sure that we're on the same page)

    c. I assume you chose the first (angular [a workspace with a single Angular application]) and then did yarn add -D @nrwl/nest d. Then nx generate @nrwl/nest:app micro-root --frontend-project dashboard

Up until that point it's pretty clear. But then, did you run a. nx generate @nrwl/nest:gateway and provided a name, or failed to provide a name and got an error? b. nx generate @nrwl/nest:gateway --dry-run and the schematic did not ask you to provide a name? c. nx generate @nrwl/nest:gateway and you accidentally provided -dry-run as the name?

On my side, it asked me to provide a name every time, whether I added the --dry-run flag on the command or not.

Please let me know of the exact steps you followed so that I can help!

mandarini commented 3 years ago

Hmmm, I just saw your other issue here. So, I understand that the schematic worked fine for you in the end, but it's just the --dry-run flag that's not working properly. :) Well, I will close this issue now, since I see that it's working on your side! I will look into the other issue now! :)

mandarini commented 3 years ago

Reopening, because I found the case where it fails. Looking into it.

Please, @nhhockeyplayer , confirm that your workspace was setup like this:

Screenshot 2020-11-24 at 3 59 19 PM
mandarini commented 3 years ago

This has now been fixed! Closing this issue!

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.