Skip to content

[Feature Request] Better --module resolution for all generated types #5461

Closed
@delasteve

Description

@delasteve

Bug Report or Feature Request (mark with an x)

- [x] feature request

Prerequisite

Given a project

ng new test-proj
ng g m foo
ng g m foo/bar

Current functionality.

When a user wants to pair a type with a module, the user has to specify the full path to the module, like so:

ng g s baz --module=foo/foo.module

or

ng g s baz --module=foo/foo.module.ts

Desired functionality.

A user should also be able to enter the following command

ng g s baz --module=foo

Mention any other details that might be useful.

Currently, the CLI will error when it can't find the module with

Module specified does not exist

When given

ng g s baz --module=foo

the CLI should preform the following module resolution

src/app/foo.module.ts
src/app/foo/foo.module.ts
Error: Module specified does not exist

This should not be exclusive to top level directories. This scenario should work as well.

When given

ng g s baz --module=foo/bar

the CLI should preform the following module resolution

src/app/foo/bar.module.ts
src/app/foo/bar/bar.module.ts
Error: Module specified does not exist

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions