当我们进行离子状态恢复,保存,清除和重置时,实际发生了什么?

cod*_*der 1 android ios ionic-framework ionic2 ionic-cli

当我们执行以下ionic state命令时,项目实际发生了什么 ?

  • restore
  • save
  • clear
  • reset

在什么样的情况下我们需要使用它们?

我搜索了这个,但没有找到任何适当的答案细节.

我感谢您的帮助.

0x1*_*ad2 10

您可以随时查看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',
Run Code Online (Sandbox Code Playgroud)

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

已从CLI v3中删除了状态:插件和平台可以完全由Cordova管理.请从package.json文件中删除cordovaPlatforms和cordovaPlugins键.如果您使用的是Cordova 7,请查看有关Cordova如何使用config.xml和package.json来管理插件和平台的公告.