-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Create a new NestJS through a shcematic doesn't put it in the right folder #1658
Comments
Dear @Maryannah , that is most likely, because In order to fix your issue, simply create a {
"language": "ts",
"collection": "@nestjs/schematics",
"sourceRoot": "apps/api/src"
} Please adapt the @vsavkin or @FrozenPandaz : Maybe we can add this All the best |
I was about to submit a similar issue until I came across this issue by @Maryannah - I would like to extend the discussion around this issue to accommodate or consider multiple Nest apps. In my original case, I am using the Angular Console via VSCode and when I click on "Projects", find my Nest application and click its "Generate" button, any
When I would expect something like this when generating off a Nest project via the "Projects" page:
|
@METACEO , please see my answer. This is, because Simply add the |
I think the question was about handling several nest projects. Will adding this file automatically work for 2, 3, 4 nest projects ? |
@Maryannah : no, because you need to "hardcode" the path to the project you want to add the module / controller / service / ... to (i.e., the However, if you specify the |
further comments: i mean, the generators are fine, but after a time you don't really use them a lot i think.. i mostly create my service / controllers / modules myself.. so i guess this is not really a problem 🤔 |
And would it be possible to do it like Angular, with a parameter to choose the app ? And your answer is opinionated, while I agree with you, we both can't speak for every people that uses the generator, hope you understand ! |
@Maryannah of course. I believe, the best option is to auto-generate the However, it also may be possible to add an additional parameter to the schematics cli interface to select the specific app / lib to be used when generating respective file.. |
Well, while I'm not here to argue if the lack of the |
It would be great to have "auto-generate the nest-cli.json file upon creating the first nest application" between now and a fuller implementation. |
It is more complicated than creating Fortunately, This is working without problems in my environment, and if this correspondence is not a problem, I would like to give a PR as a schematic. |
Folks. I looked into it. It looks like generating a So I don't think there is anything that needs to be done on the Nx side. Your options are:
We are also working on improving Angular Console, so you can right click on a folder and invoke a schematic from it. We will keep this use case in mind, such that we either create |
Has anyone tested whether the Nest CLI might notice and use a config file at the per-app level of the file layout? Our whether it could be cajoled to do so? |
@kylecordes If I wanted to reference the file layout of angular.json, I could solve it by bridging using the workspace schematic. |
Folks. I'm going to close this issue because it should be fixed on the NestJS side. But I'm happy to chime in if you talk about it with Kamil. |
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. |
Prerequisites
Please answer the following questions for yourself before submitting an issue.
YOU MAY DELETE THE PREREQUISITES SECTION.
Expected Behavior
I am using the Angular console to create a new NestJs controller. The outputted command is
I expect the controller to be placed inside my Nest application (apps/api)
Current Behavior
The output of the console is
And indeed, the controller is put at the root of the projet, under a new folder src, not under apps/api.
Steps to Reproduce
Context
angular.json
configuration = untouchedOther
I have tried giving a path as the optional parameter, to no success. (still in src)
I have tried giving a source root, to no success (still in src)
The text was updated successfully, but these errors were encountered: