Angular 7 was officially released this week, with lots of new features. Apart from being officially released, nothing else (feature wise) has changed since my last post on Angular 7. In this post, we will look at CLI Prompts and Generating a Minimal Project, some of the new features for Angular CLI 7. The first feature is, in my opinion, the most important feature for Angular CLI 7. The second one is kind of interesting. Of course, the new version of Angular CLI, has more than these two new features. Like it now supports Node JS 10 and Typescript 3.1, lots of bugs fixes and performance improvements. But today, let’s just focus on these two. So, without further ado:
CLI Prompts
Basically, when a user is performing common tasks, they get asked questions to help change the default options of the task. Before CLI Prompts, to change the default options, you needed to use command line flags to specify options. But with CLI Prompts, Angular CLI will prompt you with questions and options for you to answer. Of course, command line flags are still available for more advanced options and CLI Prompts are not meant to replace them. For instance, when creating a new app, using ng new, will prompt you with two options. The first option will prompt you on whether you want to add routing support. While the second option will ask you which stylesheet (CSS, SCSS, SASS etc.) you would like to use.
As of the release of Angular 7, this works with Angular Material, and am guessing other first party libraries and partners will support it too. The good news though, is that CLI Prompts are part of Angular Schematics. This means any library that supports Schematics, can integrate with CLI prompts.
CLI Prompts are useful to developers, as they help them discover features and configuration options organically. It reduces the number of ng command line flags you need to remember when performing simple tasks. For instance, I always forget to set default style sheet and to enable routing, when starting a new project. But with CLI Prompts, it’s refreshing that I don’t have to worry about forgetting to set those two options anymore.
Generating a Barebone Angular Project
This is one interesting feature, that kind of went under the radar. Basically, when creating a new angular application, when you add the –minimal, it will generate a barebone project. This means that, all testing NPM libraries will not be included in your project. The goal of the –minimal flag is to reduce the size of the initial angular project. This is important for students and developers who are tight on disk space. The feature is also controversial, since industry best practices recommend writing of tests, yet there is a sizable developer population that don’t write tests or see the need to. You can find the discussion for this feature here. Basically, to most of those developers, those packages are just getting in the way. Here is an example of what package.json
looks like for a new project generated with the minimal flag.