After the announcement of CLI v3 Beta and testing by beta testers in their Ionic projects, Ionic CLI version 3 is now Available Officially.
Its not just a version change, Version 3 is a major change and got lots of new improvements and features. Let’s take a look at some of the key improvements to the Ionic CLI.
Speed + Guidance
The first thing you should notice is the install time: the new CLI install is significantly faster. This is partly due to eliminating over 90MB of dependencies and thousands of lines of legacy code! Now when you install the CLI, you get a much smaller footprint as well as a faster install time. One measure shows install time reducing from 150 seconds for CLI v2 to around 10 seconds for CLI v3!
Another consideration was providing more help, guidance, and feedback. A large number of commands now provide interactive prompts when information is needed. The CLI tries to be informative and helpful when problems arise. Command help has also been improved. Just append
--help to any command for a detailed overview of inputs and options. Most commands also have interactive prompts. For example a common use cases, check out the details of
ionic start --help:
Instead of providing everything in one global install, plugins are now split out non-essential commands and functionality into CLI plugins. This keeps the core small, while still offering valuable, project-specific functionality in plugins.
For the first release of CLI v3, there are four official CLI plugins:
@ionic/cli-plugin-ionic-angular– Ionic Angular project plugin that provides useful build tools and generators.
@ionic/cli-plugin-ionic1– Ionic 1 project plugin that has functionality ported from the old CLI.
@ionic/cli-plugin-cordova– Essential for an Ionic/Cordova app.
@ionic/cli-plugin-proxy– For proxying CLI requests through a firewall.
ionic build is now
ionic cordova build) are different because this was necessary as Ionic developers are beginning to create Ionic apps for desktop, PWAs, and other platforms.
Getting Started with CLI v3
Install the new CLI globally (after uninstalling the old one):
npm uninstall -g ionic npm install -g ionic@latest
In your Ionic project directory (and assuming you have a standard Ionic project structure), try running a command, such as
ionic info. The CLI attempts to identify your project type and will prompt you to install the respective plugin. If you run
ionic cordova, it will prompt you to install the Cordova plugin. If you run
ionic --help, you’ll see a list of all commands.
You’ll need both the Cordova plugin (
@ionic/cli-plugin-cordova) and the project plugin (
@ionic/cli-plugin-ionic1) to continue developing an existing Ionic/Cordova app:
For Ionic Angular:
npm install --save-dev --save-exact @ionic/cli-plugin-ionic-angular@latest npm install --save-dev --save-exact @ionic/cli-plugin-cordova@latest
For Ionic 1:
npm install --save-dev --save-exact @ionic/cli-plugin-ionic1@latest npm install --save-dev --save-exact @ionic/cli-plugin-cordova@latest
The CLI will also occasionally check for updates and prompt you when there’s updates available.