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 generate wrong path #9444

Closed
probert94 opened this issue Jan 30, 2018 · 2 comments
Closed

ng generate wrong path #9444

probert94 opened this issue Jan 30, 2018 · 2 comments

Comments

@probert94
Copy link

probert94 commented Jan 30, 2018

Since some time I am using nrwl/nx to manage multiple apps in an Angular-CLI project.
The nrwl/nx extends Angular-CLI with new schematics and a little different project strukture, which separates apps and libs (shared modules and code).
The structure of a project looks like this:

- apps
-- app1
--- e2e
--- src
-- app2
--- e2e
--- src
- libs
-- lib1

However, I noticed, that when I generate a new app using ng generate app app2, it generates the following structure:

- apps
-- app1
--- e2e
--- src
-- app2
--- e2e
--- apps
---- app1
----- src
- libs
-- lib1

I have been searching for this issue in nrwl/nx and I found a few related Issues:
nrwl/nx#131
nrwl/nx#140

However they all point to #7960 which already is closed, so thats why I opened a new Issue.

Versions

Angular CLI: 1.6.6
Node: 8.5.0
OS: win32 x64
Angular: 5.2.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

@angular/cdk: 5.1.0
@angular/cli: 1.6.6
@angular/flex-layout: 2.0.0-beta.12
@angular/material: 5.1.0
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.6
@schematics/angular: 0.1.17
typescript: 2.5.3
webpack: 3.10.0

Repro steps

  • Create a new Angular-CLI project (ng new demo)
  • Navigate into the project (cd .\demo\)
  • Install @nrwl/schematics as a devDependency (npm i -D @nrwl/schematics)
  • Convert the project into a @nrwl/nx workspace using ng g workspace demo --collection=@nrwl/schematics
  • Remove @angular/cli "file" from dependencies in "package.json" (version 1.6.6 is used in the devDependencies)
  • Run npm i -D @angular-devkit/[email protected] (see Creating new component shows error:TypeError: core_1.PriorityQueue is not a constructor #9374 for more details)
  • Run npm install to add additional dependencies
  • Generate a new app using ng g app demo2

Observed behavior

  create apps/demo2/e2e/app.e2e-spec.ts (269 bytes)
  create apps/demo2/e2e/app.po.ts (201 bytes)
  create apps/demo2/e2e/tsconfig.e2e.json (391 bytes)
  create apps/demo2/apps/demo/src/assets/nx-logo.png (71592 bytes)
  create apps/demo2/apps/demo/src/assets/.gitkeep (0 bytes)
  create apps/demo2/apps/demo/src/environments/environment.prod.ts (51 bytes)
  create apps/demo2/apps/demo/src/environments/environment.ts (387 bytes)
  create apps/demo2/apps/demo/src/favicon.ico (5430 bytes)
  create apps/demo2/apps/demo/src/index.html (291 bytes)
  create apps/demo2/apps/demo/src/main.ts (370 bytes)
  create apps/demo2/apps/demo/src/polyfills.ts (2667 bytes)
  create apps/demo2/apps/demo/src/styles.css (80 bytes)
  create apps/demo2/apps/demo/src/tsconfig.app.json (294 bytes)
  create apps/demo2/apps/demo/src/app/app.module.ts (342 bytes)
  create apps/demo2/apps/demo/src/app/app.component.html (520 bytes)
  create apps/demo2/apps/demo/src/app/app.component.spec.ts (607 bytes)
  create apps/demo2/apps/demo/src/app/app.component.ts (258 bytes)
  create apps/demo2/apps/demo/src/app/app.component.css (0 bytes)
  update .angular-cli.json (2448 bytes)

Note that the src of the newly generated app lies under apps/demo2/apps/demo instead of apps/demo2.

Desired behavior

The src of the newly generated app should be in apps/demo2, so that the structure is the same as in the first app.

Mention any other details that might be useful (optional)

If you don't execute step 5 (Remove angular/cli "file" from dependencies in "package.json") it is using the @angular/cli version 1.6.0 from the .angular_cli.tgz-File. With this version, everything seems to work just fine.
So I guess the bug has been introduced in one of the last versions.

@filipesilva
Copy link
Contributor

I'm sorry, but this is an issue you have to bring up with the https://github.com/nrwl/nx folks. If part of the the reproduction steps include converting the project to the Nx setup then it really sounds like it's an integration thing. Maybe their setup doesn't support the latest CLI versions.

Happy to take a look again if you can provide a repro that doesn't need modifications like Nx.

@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 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants