Skip to content

Generating Blueprints in directory other than src/app #5995

Closed

Description

@somombo

Bug Report or Feature Request (mark with an x)

- [ ] bug report
- [x] feature request

I posted the following question on gitter:

hi.. If I change the name of the folder src/app to say src/lib how do i ensure that if I do things like ng generate component foo, angular-cli will know to place the FooComponent in src/lib? Is there something in .angular-cli.json I'm supposed to update? Thanks

@hansl was kind enough to respond:

@somombo no way right now unfortunately. We’re working on removing the hard coded app directories, in favor of looking at the bootstrapping code.

@hansl that's nice for apps that are bootstrapped. But if someone is working on let's say a library that's bootstrapped only in unit tests, then that will be problematic, unless you are incorporating that into your plans somehow?

I think its not a bad idea to just have an extra configuration in .angular-cli.json to simply change the default name from "app".

Another alternative resolution for the meantime, is to allow the following to command to work
ng generate directive mydirname --export --module="../lib/mylib.module"

It current results in the error:
Invalid path: "../lib/quill.module.ts" cannot be above the "src/app" directory

Ultimately I could see having multiple sibling source directories at "src/*" level such some subset of :

["app", "browser", "server", "common", "android", "ios", "webworker" , "lib"]

(I'll call these "ngRoots", so for example the ngRoot directory server is located at "src/server")

It would be nice to have the ability to generate blueprints by specifying relative which ngRoot directory they should generated in. e.g.

ng generate directive mydirname --export --module="./mylib.module" --ngRoot="./lib"

Thought?

Activity

  1. filipesilva commented on May 5, 2017

    @filipesilva
    Contributor

    There's a couple of things in this issue:

  2. somombo commented on Oct 5, 2017

    @somombo
    Author

    looks like #6079 fixes this

  3. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    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.

  4. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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