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

adding gateway produces malformed file name #4130

Closed
nhhockeyplayer opened this issue Nov 22, 2020 · 5 comments
Closed

adding gateway produces malformed file name #4130

nhhockeyplayer opened this issue Nov 22, 2020 · 5 comments
Assignees
Labels
outdated scope: node Issues related to Node, Express, NestJS support for Nx type: bug

Comments

@nhhockeyplayer
Copy link

nhhockeyplayer commented Nov 22, 2020

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
Copy link
Member

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)]
    Screenshot 2020-11-24 at 1 14 27 PM
    (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 mandarini self-assigned this Nov 24, 2020
@mandarini
Copy link
Member

mandarini commented Nov 24, 2020

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
Copy link
Member

mandarini commented Nov 24, 2020

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

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

  • empty workspace
  • CLI to power the Nx workspace (Use arrow keys)
    ❯ Nx [Recommended for all applications (React, Node, etc..)]
    Resulting that you have a workspace.json file and NOT a angular.json file.

Screenshot 2020-11-24 at 3 59 19 PM

@mandarini mandarini reopened this Nov 24, 2020
@vsavkin vsavkin added the scope: node Issues related to Node, Express, NestJS support for Nx label Nov 27, 2020
@mandarini
Copy link
Member

This has now been fixed! Closing this issue!

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: node Issues related to Node, Express, NestJS support for Nx type: bug
Projects
None yet
Development

No branches or pull requests

3 participants