Angular-cli: I don't want to call my 'app', 'app'.

Created on 7 Feb 2017  ·  13Comments  ·  Source: angular/angular-cli

There is an assumption that I want have a /src/app folder. When I do not really want to have this folder. I actually want to have /src/{{moduleName}}/ , but totally appreciate using /src/app as a standard.

It'd be really nice if https://github.com/angular/angular-cli/blob/c889dd8e9408f02bf8b1138c9cff15d27d1140dc/packages/%40angular/cli/utilities/find-parent-module.ts#L6 just used root instead of enforcing 'app' and the angular-cli.json use src/app as root or there was another property for app folder on the application entity.

This would help enable multiple apps in one project...

a la
https://github.com/angular/angular-cli/issues/1140

the apps proper in ng-cli.json is already an array.

Most helpful comment

Hi @filipesilva,

I'm afraid the #4754 didn't fix this issue.

I've tried to implement with the --app, but now I have some app folders, with the app folder still.

Eq:

+-- /src
     +- /admin
     |  +- /app
     |     +- admin.component.scss
     |     +- admin.component.html
     |     +- admin.component.spec.ts
     |     +- admin.component.ts
     |     +- admin.module.ts
     |
     +- /shop
        +- /app
           +- shop.component.scss
           +- shop.component.html
           +- shop.component.spec.ts
           +- shop.component.ts
           +- shop.module.ts

Any way to get rid of the /app and use the generate still?

PS: I can remove by myself and run serve/build and so on, but I won't be able to use generate which is the feature I'm expecting most.

I've tried to rename the root on the cli, but everytime I run generate it creates the app folder.

Eq: ng g m admin --app admin

Thanks.

All 13 comments

If the ng-cli maintainers have a direction or thoughts on this, I'm happy to implement, I just want to get a firm nod on the direction before I put in the work.

You can rename this dir with the --source-dir option when you run ng new the documentation in the wiki explains the available options here.

@Brocco, your answer doesn't resolve my issue.

That will give me {{source dir}}/app/, it's 'app' I want to get rid of...
I can easily change root in my angular-cli.json... I'm only using the
generator from ng-cli, my packaging is happening with my own webpack
configs so I can build multiple apps and libs per my project requirement,
while still getting to use the generator from ng-cli... what I really want
is a way to switch the 'app' module.. and the the generators locate the
module parent using the find-module-parent function I referenced, which
assumes the 'app' string will be there and that isn't what we have in our
projects.

@Brocco, so are you saying the maintainers of angular-cli want to keep the hard coded name and aren't open to this change?

@dopry I'm sorry my last response didn't answer what you were asking, just a simple misunderstanding.

We're certainly open to making that change, but there's some portions that are tied to that name which we'd need to ensure were all updated to allow for making that name configurable.

That being said, I'm not sure of the priority of the team working on this change. If you're willing to put together a PR, I'd be happy to help you with it.

Cool. I have some time tomorrow. I can explore a PR then. I'm sure the
angular-cli teams priorities are completely different than my own.. but
that's why we can create PRs. :) I just wanted to be sure I wasn't going to
spend my time on something that wouldn't have a chance of being accepted. :)

On Thu, Feb 9, 2017 at 2:43 PM, Mike Brocchi notifications@github.com
wrote:

Reopened #4506 https://github.com/angular/angular-cli/issues/4506.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/angular/angular-cli/issues/4506#event-956189590, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAXqOH66lbP0lzigseuMnrxI4hEl2zrCks5ra2xygaJpZM4L6Dam
.

--
Darrel O'Pry
The Spry Group, LLC.
http://www.spry-group.com
718-355-9767 x101

Not at all, there are some things that are the way they are for a reason. But making the app name configurable is not one of them.

at least tag some labels to indicate this is really a problem!

Hi @filipesilva,

I'm afraid the #4754 didn't fix this issue.

I've tried to implement with the --app, but now I have some app folders, with the app folder still.

Eq:

+-- /src
     +- /admin
     |  +- /app
     |     +- admin.component.scss
     |     +- admin.component.html
     |     +- admin.component.spec.ts
     |     +- admin.component.ts
     |     +- admin.module.ts
     |
     +- /shop
        +- /app
           +- shop.component.scss
           +- shop.component.html
           +- shop.component.spec.ts
           +- shop.component.ts
           +- shop.module.ts

Any way to get rid of the /app and use the generate still?

PS: I can remove by myself and run serve/build and so on, but I won't be able to use generate which is the feature I'm expecting most.

I've tried to rename the root on the cli, but everytime I run generate it creates the app folder.

Eq: ng g m admin --app admin

Thanks.

Please enable us to configure this. It's really annoying when you working on a long running project and want to fit Angular in with your existing mvc api, and don't want to maintain a duplicate file structure, for example.

@nnit-TroelsJensen the newest @angular/cli lets you set the path into angular.json.

See the https://github.com/nrwl/nx as a reference: https://github.com/nrwl/nx-examples/blob/master/angular.json

PS: Perhaps, you might need to fix the generators using schematics.

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

purushottamjha picture purushottamjha  ·  3Comments

NCC1701M picture NCC1701M  ·  3Comments

rajjejosefsson picture rajjejosefsson  ·  3Comments

hareeshav picture hareeshav  ·  3Comments

MateenKadwaikar picture MateenKadwaikar  ·  3Comments