-
Notifications
You must be signed in to change notification settings - Fork 12k
Generate standalone library project #10929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Manual way to remove the default project
|
There isn't a flag to do this on |
For me, the use case is just about having a way to |
@Wykks I'm also for that. Having special dirs outside projects seems counterintuitive once you start using the cli for more. |
I also think that it would be more clear if the default project was inside the projects folder. |
I think it is better to keep the default project outside the projects directory - it is then ideal for knocking up tests for any packages built in the projects directory without having to create some sort of 'myTestPackageProject' to do so. For exmaple, my deployment could build all projects in /projects - without having to decide which are just handlers for testing my libraries. |
Related to #11402 |
Step number 4 is not accurate - well, it is not with the versions specified below. It doesn't install the required dependencies when the library is created.
These are the dependencies I have:
For extra bonus points to run the unit tests. These devDependencies are required (the last two normally are just dependencies):
No need for peerDependencies in the library package.json. The library dependencies need to be installed in the main library project and in the project where it needs to be used. Here is another down side of this approach and I don't understand why if you have a peerDependency in the library and the actual library installed in the project where the library will be used, it doesn't work. Creating an empty project and the library in it seems to do the trick - with a trick, I actually mean, being able to extract an Angular library to a separate repo away from any project. In my humble opinion, the design of this Angular feature doesn't have much sense as it is supposed to be useful to extract code but then the code has to live in the same repo. I understand the potential difficulty of managing the same angular framework versions over the libraries and the apps, however, this is not bad enough for me to keep all the code in the same repo. I base my opinion on the fact that maintaining the angular framework versions align should not be a hard job given that it is code normally written to be consumed by yourself, so no risk of incompatibilities. I really wish that the capability of creating standalone libraries gets added. |
BTW, any update on this thing? |
Welp since 7.0 you can create a new project without the default project (#12216) This issue should be closed |
Ok, that is good. |
@sergiojoker11 I'm developing a component library right now without the default application. I started my project by running When building the library with Edit: Additionally, I used |
Closing as per @Wykks comment, thanks! |
@gbrlsnchs smashing, thanks! |
@gbrlsnchs Beautiful. I missed that --create-application flag under https://angular.io/cli/new That's so useful. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Are there any plans to support generating a standalone single library project without generating a app? Right now you use
ng new
to create a new app and then add a library withng g library
. Are there any plans to add a--lib
option tong new
if you wish to have a standalone git project?I know there are numerous workarounds such as just ignoring the empty app or sticking your shared lib in some app project but this would be useful.
edit: so I just found out
ng new
really generates a workspace + a default project outside theproejcts
dir. Maybe the solution is just not generate the default project and make a lib instead if the rest of the cli thinks of things in terms of workspaces.The text was updated successfully, but these errors were encountered: