Search code examples
angularpackage.jsonworkspacenew-projectangular14

New Angular project created without package.json, angular.json, etc


I decided to create a library for Angular as a way to learn a bit more about it. I work every day with Angular but have never set up a project from scratch. I've never had to actually deal with an empty environment, create the backbones of a project, the first CSS classes and so on.

I also decided to do this on the currently latest version of Angular (14) to also learn what new it has to offer (I work with Angular 8 at work), so maybe my problem is just that it changed over time and I'm assuming things wrong.

That being said, here is my issue:

Angular documentation says I should create a workspace for working with libs if I want to use the lib without publishing it. Since I'm still not sure if I'll ever publish this, that's what I did. So I created a workspace called angular-14. It aparently also set up a git repo automatically, but I removed the .git and .gitignore because I plan on versioning each project separately:

enter image description here

Then, I created my library project under the projects folder, which looks like this by default:

enter image description here

So far, so good. Now, lets create an application project that will use this library, and here comes the issue:

enter image description here

No angular.json, package.json or package-lock.json. I was also expecting it to have a tsconfig.json and not only tsconfig.app.json.

Does that mean I'll have to rely on the files present in the workspace (and therefore I'm stuck and will have to version the whole workspace)? Or should I manually create these files?

I noticed it because WebStorm didn't set up the run/debug configuration automatically. ng-serve is working as intended, though.

It also didn't create an e2e folder, but that I assume is just that I forgot to add some parameter in the project creation. This is probably not going to be a product, so I will focus on learning just the library development thing for now.

Thank you very much


Solution

  • Well, yes. Turns out this is all normal Angular. Normal applications also work inside workspaces but the project files are merged with the workspace files. When we need to make a lib, it requires to separate the project in a Projects folder. This is intended for people to have multiple projects sharing the same configuration.

    This doesn't help me though as if I decide to make only one project inside the workspace open source, I'll have a problem. So what I'm going to do instead is to just create a dummy application inside this workspace to test the library and in case I actually decide to use this in a project, I'll have to publish it and use it like everyone else would.