Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Cannot generate a component on a dir path other than the default "app/"  #476

@shairez

Description

@shairez

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Area

- [ ] devkit
- [x] schematics

Versions

Node v8.9.0
Npm 5.6.0
Windows 10

Repro steps

Let's say I have the following structure -

app/
  app.module.ts

custom-app/
  app.module.ts

And I want to create a new component under custom-app

From the root of the project, trying to run any of these :

ng g c my-comp -m="../custom-app/app.module.ts"
or
ng g c custom-app/my-comp -m="../custom-app/app.module.ts"
or even
ng g c /src/custom-app/my-comp -m="../custom-app/app.module.ts"

results in a component being created under the /app folder and not /custom-app.

The log given by the failure

  create src/app/custom-app/my-comp/my-comp.component.html (26 bytes)
  create src/app/custom-app/my-comp/my-comp.component.spec.ts (629 bytes)
  create src/app/custom-app/my-comp/my-comp.component.ts (271 bytes)
  create src/app/custom-app/my-comp/my-comp.component.css (0 bytes)
  update src/custom-app/app.module.ts (419 bytes)

Desired functionality

I would expect that -

  1. Specifying a module would create the component underneath that specific module's folder

  2. If not, at least specifying a different path (starting from the src folder) will generate that component under that custom path

Mention any other details that might be useful

none

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions