IsraGab
IsraGab

Reputation: 5175

How to generate library in a specific folder with angular-cli?

I am using angualr7 with angular-cli and I am able to create new library with the following command.

E:\Coucou>ng generate library my-lib

By default it will add it under the project folder,but I need to generate the library under a sub folder of projects. Is there a way to do with angular-cli?

Upvotes: 5

Views: 8194

Answers (5)

Arne
Arne

Reputation: 842

Since this is still the primary Google result, and it took me way too much time to figure out:

You can just use the --project-root=<your directory> flag

Upvotes: 0

Md Rafee
Md Rafee

Reputation: 5530

you can change the default project directory to the desired directory in the angular.json

"newProjectRoot": "your desired directory",

Upvotes: 4

FRM
FRM

Reputation: 194

I had this same issue and solved it by scoping to the subfolder.

ng generate library @subfolder/my-lib

Upvotes: 17

San Droid
San Droid

Reputation: 332

ng generate library my-lib --directory=folder

Upvotes: -2

Juan Carlos Oropeza
Juan Carlos Oropeza

Reputation: 48187

Just add the path. remember are relative to where you are

E:\Coucou>ng generate subFolder\library my-lib

or

E:\Coucou>ng generate C:\subFolder\library my-lib

Upvotes: -2

Related Questions