1. It will show you how it’s going to work before it writes any files.
Angular CLI includes a series of flags. One of Angular CLI’s most useful flags has to be the ‘dry’ flag or ‘-d’. Dry allows you to run any CLI command and watch a tail of what the CLI would would have written (except with the -d flag), none of your projects’ files are actually changed, and no new files are created. This is perfect for beginners to the CLI who are afraid they may make destructive changes by accident. It’s also a great way to get oriented with the CLI and the way an ideal Angular project should be structured.
2. You get build tools right out of the box, including a prod build.
Gone are the days where you would have to spend a week messing around with minifiers and uglifiers to find the best way to build your project for your dev and prod environments. Angular CLI built projects have this right out of the gate. If you create a new app with `ng new app`, the CLI will create the ideal Angular starting environment for your app. This setup comes complete with a starter app/main module and component as well as a development, test, and production build complete with webpack optimized main and vendor JS bundles of your transpiled typescript code with no configuration required.
3. You can still write things manually without having to eject.
One concern engineers may have with a framework, like Angular CLI, may be what happens when you run into a situation where you’re forced to introduce a strange pattern that doesn’t fit the opinion of the CLI? Well the good news is Angular CLI won’t force you to eject from the CLI when you need to go outside of the box and create some off-the-wall patterns. With Angular CLI, ejecting from the CLI deals more with build configurations than the CLIs opinionated scaffolding standards. However, if you do decide you need to eject, the CLI will run some changes on your config files to make them easier for you to modify by hand, like creating a separate webpack config file. Take note that once you eject from the CLI, you can’t really go back to using the CLI for you project.
4. It makes generating perfect Angular classes a breeze.
One of the most powerful commands in the Angular CLI is the generate command. With generate you can create perfect components, services, modules, directives, interfaces, and pipes in seconds using only one line of text. Each generator comes with a special set of flags that allow you to further customize exactly what is generated. Here are a few of the flags you could use with the `ng generate component` command when starting a new component.
- –app will specify which app name to use
- –flat will determine whether or not a directory is created for your component (default: false)
- –export specifies wether or not your component will be module exported (default: false)
- –inline-style specifies if the styles will be in the ts file or a separate CSS file (default: false)
- –inline-template specifies if the template will be in the ts file or in a separate HTML file (default: false)
- –module allows you to declare which module this component will be added to
- –spec allows you to skip generating a spec file for testing this component (default: true)
5. It encourages you to test more.
Another great thing about the CLI is that it will create some baseline test for your classes as you generate them, making it even easier to write unit tests. It also comes setup for you to start writing end-to-end tests, and uses Jasmine and Karma to power all of this. To make it even better, running the tests are as easy as typing in ‘ng test’ and they can be configured to run as part of your production build.
Interested in learning more about Yipee.io? Sign up for free to see how Yipee.io can help your team streamline their development process.