What does actually happen when we do ionic state restore, save, clear and reset?

coder picture coder · Feb 23, 2017 · Viewed 8.2k times · Source

What does actually happen in the project, when we do following ionic state commands?

  • restore
  • save
  • clear
  • reset

In what kind of situations do we need to use them?

I googled about this, but couldn't find any appropriate answer with details.

I appreciate any kind of your help.

Answer

0x1ad2 picture 0x1ad2 · Mar 1, 2017

You could always look into their source code for the Ionic CLI v1/v2

save: 'Save the platforms and plugins into package.json',

restore: 'Restore the platforms and plugins from package.json',

clear: 'Clear the package.json of cordovaPlugins and cordovaPlatforms, '
  'as well as clear out the platforms and plugins folders',

reset: 'Clear out the platforms and plugins directories, and reinstall plugins and platforms',

https://github.com/driftyco/ionic-cli/blob/fac1c4d7b49e7c102269f3d5e0acef660d762bf5/lib/ionic/state.js#L20-L33

state has been removed from CLI v3: The plugins and platforms can be managed entirely by Cordova. Please remove the cordovaPlatforms and cordovaPlugins keys from your package.json file. If you're using Cordova 7, please review the announcement about how Cordova uses config.xml and package.json to manage plugins and platforms.