594 Views

Ionic CLI v3.0 Announced

Ionic framework has just announced Ionic CLI v3.0. Now, what does this mean for developers?

Major Improvements

Ionic CLI v3 mostly foucsed on improving the speed and guidance and it has succeeded in following ways.

Speed

One of the major improvement in version 3 of CLI is in the Speed. The new CLI installs incredibly fast as they have eliminated tons of dependencies and thousands of lines of legacy code. Also they have made the core small and provided specific functionalities in specific plugins. In the new CLI non-essential commands and functionality comes in plugins. For first release there are four official 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.

They have placed the cordova specific functionality is a plugin because now more and more developers are using Ionic to develop desktop apps, PWAs and and other platforms. Also the cordova specific commands comes in new namespace. For example, now there are two build commands ionic build and ionic cordova build.

Guidance

The new CLI provides more comprehensive and interactive help and guidance. It provides global help describing all commands as well as command specific help. Also it helps by providing interactive help when something goes wrong.
For example ionic start --help will provide detailed description of the start command as below.
ion12_1.png

The new CLI will also occasionally check for update and prompt when updates are available.

To show the difference between Ionic CLI v2 and Ionic CLI v3, the Ionic team have put up a beautiful cheatsheet.
ion12_2.png
The original cheatsheet can be found here

Getting started with Ionic CLI v3

Before installing the new CLI, uninstall the previous one.

npm uninstall -g ionic
npm install -g ionic@latest

*Some platforms may require you to use sudo in front of the command for it to work.

Getting existing projects to work with new CLI

As mentioned earlier, the new CLI has broken down the functionality into core and plugins. You have to install specific plugins for the new CLI to work with your existing projects. And the new CLI makes it very easy. In your existing project directory just run ionic info command. This should identify your project type and prompt you to install the specific plugins required.
ion12_3.png

And if you run ionic cordova command, it will prompt you to install Cordova plugin.

You’ll need both the Cordova plugin (@ionic/cli-plugin-cordova) and the project plugin (@ionic/cli-plugin-ionic-angular or @ionic/cli-plugin-ionic1) to continue developing an existing Ionic/Cordova app.

 

For Ionic Angular projects:

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 projects:

npm install --save-dev --save-exact @ionic/cli-plugin-ionic1@latest
npm install --save-dev --save-exact @ionic/cli-plugin-cordova@latest

Enjoy Ionic CLI v3.0.
For official blog post please visit http://blog.ionic.io/announcing-ionic-cli-v3/,

Related Posts

This post is trending.

Setting up Ionic View for Testing Ionic App

Introduction Ionic View is by far the best thing Ionic framework provides. The problem with hybrid apps is that we need to […]

%d bloggers like this: