Ionic-cli: bug: `ionic state reset --plugins` resets platforms

Created on 27 Apr 2015  路  10Comments  路  Source: ionic-team/ionic-cli

_From @RangerRick on April 25, 2015 16:10_

Type: bug

Platform: all

When I run ionic state reset --plugins it also resets platforms:

``````
Sin:~/git/opennms-compass ranger$ ionic state reset --plugins
Removed platforms and plugins
Attempting to restore your Ionic application from package.json

Restoring Platforms

cordova platform add android
cordova platform add browser
cordova platform add ios

Restore platforms is complete

Restoring Plugins

cordova plugin add org.apache.cordova.console
cordova plugin add org.apache.cordova.geolocation
cordova plugin add org.apache.cordova.inappbrowser
cordova plugin add org.apache.cordova.network-information
cordova plugin add org.apache.cordova.splashscreen
cordova plugin add org.apache.cordova.statusbar
cordova plugin add com.google.cordova.admob
cordova plugin add cc.fovea.cordova.purchase
cordova plugin add com.ionic.keyboard
cordova plugin add https://github.com/RangerRick/cordova-certificate-plugin.git
cordova plugin add com.ohh2ahh.plugins.appavailability
cordova plugin add com.google.playservices
Restore plugins is complete

Ionic state restore completed

Ionic reset state complete
```

_Copied from original issue: driftyco/ionic#3617_
``````

Most helpful comment

this still happening... 馃槥

Cordova CLI: 6.5.0
Ionic Framework Version: 2.2.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v7.4.0
Xcode version: Not installed

All 10 comments

This has been fixed in the latest branch. It'll be available in the next release.

Feel free to test the beta - npm install -g ionic@extlib

This seems to still happen..

+1 I'm getting this

using [email protected] I can reproduce the opposite scenario, i.e. I run ionic state reset --platforms but it also resets plugin.

Note the first line of the output which says Removed platforms and plugins

So, while only the one passed via command line (--platforms or --plugins) is restored, both are removed

The bug is here, the removal of platforms and plugins should be separated

I sent a PR for this, it would be pretty useful to have this working.

In my use case I want to do ionic state reset --platforms as a part of a script instead of cordova platform rm android && cordova platform add android, so that the proper platform version is taken from package.json. I don't need to reset plugins, and plugin is much more costly

As a temporary fix I'm using restore instead of reset and remove things myself:

    cordova platform rm android && ionic state restore --platforms

instead of

    ionic state reset --platforms

The same problem happens with the clear command:
ionic state clear --platforms
also clears plugins, and vice versa.

this still happening... 馃槥

Cordova CLI: 6.5.0
Ionic Framework Version: 2.2.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v7.4.0
Xcode version: Not installed

The best thing to do to reset Cordova platforms & plugins is to clean out Cordova build directories and reinstall/recompile everything:

rm -rf platforms/ plugins/
ionic cordova prepare
Was this page helpful?
0 / 5 - 0 ratings