Check out a free preview of the full Angular Core course:
The "Angular CLI" Lesson is part of the full, Angular Core course featured in this preview video. Here's what you'd learn in this lesson:

Lukas talks about the importance of the Angular CLI for developing projects that adhere to the style guide.

Get Unlimited Access Now

Transcript from the "Angular CLI" Lesson

[00:00:00]
>> Lukas Ruebbelke: All right, so the first thing that you need to do if you are going to work with NSWorkspaces is that you need to install the CLI. Now, the Angular CLI is, I believe, a monumental leap forward for Angular developers. I believe that there's a React CLI, there's a Vue CLI.

[00:00:23] And what this allows you to do is to generate opinionated code and projects that adhere to the style guide. And so, fortunately, well, when Angular JS started there was no real opinion on how to build an application. It was like put your controllers in a controllers folder, put your services in a services folder.

[00:00:49] And we realized very quickly that simply does not scale. And so out of that, emerged some best practices which then was quantified in a style guide. Which then ended up in the Angular CLI as we know it. And I believe one of the biggest advantages of using the CLI is that it is predictable and consistent across developers.

[00:01:15] With the CLI that there's the ability to extend that with schematics. So I believe this really officially came in Angular 6. But now we can think of the CLI as a platform for building domain specific or specific use generators that we can use to, for instance, generate NgRx, Ionic, whatever you may need.

[00:01:40] Or even within your organization, you can generate these specific schematics for whatever it is you need to streamline development. And so, in order to install the Angular CLI, it's just npm i -g @angular/cli. And I'm not going to do this, because I already have it installed. But then the next step is that you would install the extensions, which if we hop into the readme, which is about right here.

[00:02:15] So NWRL schematics. Yeah, so anyways I had this working just perfectly. I'm almost afraid to breathe on it, all right. So with that said, let me generate an application and let's just see what happens. By the way a year, a year and a half ago, this wouldn't have taken us probably 90 minutes to do, maybe more.

[00:02:40] If it worked, it would take 90 minutes. So, create-nx-workspace and we will call this, angular-core-workshop. So, let us run. And so what this is going to do is this is going to create an Angular CLI project that is designed to hold additional Angular CLI or Angular projects. But, not only that is that it splits the file structure into applications, and reusable libraries.

[00:03:25] And so after this generates, and we kind of start to see this working, I'll elaborate on why that's important. But if we go into this folder,
>> Lukas Ruebbelke: And we just go code, and I'm gonna insert a new id here.
>> Lukas Ruebbelke: Zoom this out, what we have here is an apps folder and a libs folder.

[00:03:59] And we have some additional files down here. But for the most part, this is basically, it has most of the pieces for an Angular CLI project and your Angular CLI commands will work.
>> Lukas Ruebbelke: And if we go down to package.json, you can see that ng for the Angular CLI start, build, test, so these are pretty stock but then down here we have some additional commands, such as, format right, format check, etc.

[00:04:38] So, with that said, I'm going to close this down and this is exactly where I left off or when you check everything in, this is exactly what you get, minus the resources folder.