Ionic CLI v3 Release

May 21, 2017 · 3 min read · 518 Words · -Views -Comments

Original post Hello everyone, we are excited to announce that Ionic CLI v3 is now available! Since we released the CLI v3 beta and the Easter egg, we saw many early beta testers successfully use it in their Ionic projects. They provided tons of feedback and had chances to win prizes. In fact, many of them found the Easter egg within hours. Recently, at our hackathon, developers became Ionic Jedi Hacksters and we got even more feedback. (Hackathon results here) Beyond the version change, what makes this CLI special? Here are key highlights.

Speed + guidance

You may notice the install is much faster, partly because we eliminated 90MB+ dependencies and thousands of lines of old code. Now the CLI takes less space and installs faster. Speed and performance are major goals.

We also want to provide more help, guidance, and feedback. Many commands now provide interactive info. The CLI tries to be useful when problems arise. The help system has been improved. Just add --help to any command for detailed info and parameters. We also provide examples, e.g. try ionic start --help.

Plugins

We took a different approach: instead of bundling everything, we moved non-essential commands into plugins. This lets projects add features as needed while keeping the core small.

For the first v3 release, there are four official plugins:

@ionic/cli-plugin-ionic-angular - build tools and generators @ionic/cli-plugin-ionic1 - CLI for ionic1 projects @ionic/cli-plugin-cordova - essential for ionic/cordova projects @ionic/cli-plugin-proxy - proxy plugin

In beta, a common question was “why commands changed”. For example, ionic build is now ionic cordova build. We felt it was necessary because developers are building desktop, PWA, and other Ionic apps. To distinguish these, we made this list.

Get started

Make sure you have Node 6+ and npm 3+.

Uninstall old CLI and install new CLI globally:

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

In your Ionic project, make sure you have a standard structure. For example, ionic info checks the project type and recommends plugins. If you run ionic cordova, it prompts to install the cordova plugin. If you run ionic --help, you’ll see all commands. For ionic/cordova apps, you need the cordova plugin (@ionic/cli-plugin-cordova) and a project plugin (@ionic/cli-plugin-ionic-angular or @ionic/cli-plugin-ionic1).

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

CLI will occasionally remind you to update these plugins.

Known issues

For CLI v3, we are working on these:

  • ionic start still takes a long time to download dependencies. (#2231)
  • ionic start does not yet support options like GitHub repos, zip URLs, or Ionic author’s projects. (#1989)
  • ionic cordova writes 4 spaces to config.xml, which can warn for existing apps. We write config.xml for resource generation and live reload.
  • For ionic1, some gulp hooks do not fire.
  • On Android devices, upgrading to CLI v3 cannot correctly extract on deploy.

For the full upgrade list, see CHANGELOG.md. For more docs, see README.md.

Questions or feedback? Create an issue in the repo. Thanks to all beta testers, especially those who contributed issues, comments, and PRs.

Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover