April 24, 2023
  • All
  • Announcements

Ionic CLI V7

Mike Hartington

Director of Developer Relation...

Howdy folks! Along with the release of Ionic Framework V7, we’re thrilled to announce the release of version 7 of the Ionic CLI. This release brings a lot of maintenance updates to the internals of the CLI as well as some new features that our community has been asking for. 

Without further ado, let’s dive into it.

Getting the New New

First and foremost, to update to the latest CLI, you can simply install the latest from npm:

npm install -g @ionic/cli@latest 
ionic -v 

If that prints 7.0.0, then you are good to go. If you run into any issues, please feel free to open an issue on the CLI repo.

Parting Is Such Sweet Sorrow

With a new major version of the CLI, we took some time to review which features made sense to keep and which features were no longer needed. With V7, it’s time we say goodbye to the following features:

  • Ionic Lab (#4960)
  • Ionic Doctor command (#4959)
  • Ionic Docs command (#4969)
  • Support for Ionic V1 and V3 project (#4978)
  • Appflow Package commands and the Deploy Build command

Developers leveraging the long deprecated Appflow commands should migrate to the Ionic Cloud CLI instead. If you use deploy build today, migrate to ionic-cloud build web and if you used the --channel option, also use ionic-cloud deploy web. If you use the package commands, then migrate to ionic-cloud build and ionic-cloud deploy.

These features of the CLI have served us well, and we salute them as they sail off into the sunset. 

The new stuff

Looking at the new features in CLI, we have lots of exciting updates to share. Starting with V7, we now support Vite projects for React and Vue! Vite support is something the community has long been asking for, so this is big. If you have an existing Vue or React project, fear not, as we still support Vue-CLI or React Scripts as well. To support this, we’ve introduced a new project type in the ionic.config.json, vue-vite and react-vite. These new project types will tell the CLI that it should call Vite when you run ionic serve or ionic build. 

This also means that when you start a new project, you’ll be given a Vite based project for React and Vue. As the community has gravitated towards Vite, we’re going to recommend it for all Vue and React projects moving forward. If you have an older project, you can start with a fresh project as a starting point and move your components over piece by piece, or migrate your existing projects based on these setups.

More Amazing Angular Updates

Though not technically tied to the Ionic CLI, the @ionic/angular-toolkit provides essential features to our Angular community. To tie into this release, we’ve also released version 8.0 of @ionic/angular-toolkit that provides some needed updates for new versions of Angular. 

Starting off, we’ve updated our minimum version support for @ionic/angular-toolkit to Angular v15, so those who have been waiting for it can finally update! 

We’ve also updated our schematics to support the newer standalone component format from Angular. Now we can generate pages that are standalone and can have them automatically added to the root routing config for your apps. By default, this flag is set to false in order to support apps that use NgModules. But you can enable it by running:

ionic g page detail --standalone

While this is great for one off commands, you might want to enable this feature always. To do this, we can use the angular.json to set the default value of the flag:

  "schematics": {
    "@ionic/angular-toolkit:page": {
      "styleext": "scss",
      "standalone": true

By setting standalone to true here, any time we create a new page, it will be a standalone setup. 

Thank you

We’re excited to get this release of the CLI out there in coordination with the latest V7 release of Ionic Framework. As always, we want to extend heartfelt thanks to our community for their contributions and suggestions that ultimately help us put out the best possible product. Update your CLI today, and be sure to let us know if you have any questions or run into any issues by filing a bug report on GitHub.

Mike Hartington

Director of Developer Relation...