Windows 10
angular-cli: 1.0.0-beta.19-3
node: 5.10.1
os: darwin x64
ng g component test-component command The prefix is relative to src, so, if you set it to src, it actually means src/src.
The generator command fails if you ask it to generate something in a directory that doesn't exist. src/src probably did not exist when you ran that, which is why you are getting the error.
Cheers,
Hi, thank you for a quick response. Unfortunately no matter what I set the prefix to in the config file the generator still is looking for the "app" prefix. Is there some other property that needs changing?
That setting controls the selector prefix not the directory.
Unfortunately, the "app" directory appears to be hard coded
That is what I thought, thanks for confirming it. I think this would be a must have for adding angular-cli to existing projects
@Brocco we should add base app folder name config to angular-cli.json, what do you think?
We have it hardcoded here (and maybe other places):
Adding it to RC1 because after that it'll be less than ideal to change the config.
@filipesilva
I tried changing just that place, but was still having issues so I'm pretty sure it's in other places
It would be possible to make it configurable, but to clarify prefix is the prefix given to component selectors when they are generated.
@Brocco Had no idea, it's a little mysterious.
Is there any plans to include what each part of the angular-cli.json file does?
@lordmat0 there are plans to make blueprints (generate templates) configurable in the future, but it is not there right now.
@Brocco we should add base app folder name config to angular-cli.json, what do you think?
We have it hardcoded here (and maybe other places):
Adding it to RC1 because after that it'll be less than ideal to change the config.
This issue was closed after Brocco said :
@lordmat0 there are plans to make blueprints (generate templates) configurable in the future, but it is not there right now.
But I don't see an anything resolving what this was primarily created for (namely: being able to change "app" to something else.), and this is the closest hit to what I am experiencing I could find online.
I am running angular cli 1.0.2 and changing name property under the project or app config does not change where my files are generated to. (I just upgraded to 1.1.3 and still can only generate to src/app/ rather than src/<name-in-config>
Perhaps I am using the configuration incorrectly?
I'm building a angular npm library where the library code is inside the ./my-lib folder and the rest around is the angular app generated by angular-cli. Can I use ng g to generate code inside the /my-lib/src folder? Thank you.
@skorunka I was looking to do the same thing, making a library with ng-packagr
You can create a second 'app' in the angular-cli.json file - in the apps array, and copy the existing app details into it. Give it a "name" e.g. "name": "lib", and you can use the ng generate as follows:
ng generate module my-mod --app=lib
That's the basics of it anyway
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._
Most helpful comment
This issue was closed after Brocco said :
But I don't see an anything resolving what this was primarily created for (namely: being able to change "app" to something else.), and this is the closest hit to what I am experiencing I could find online.
I am running angular cli 1.0.2 and changing
nameproperty under theprojectorappconfig does not change where my files are generated to. (I just upgraded to 1.1.3 and still can only generate tosrc/app/rather thansrc/<name-in-config>Perhaps I am using the configuration incorrectly?