【问题标题】:What does actually happen when we do ionic state restore, save, clear and reset?当我们进行离子状态恢复、保存、清除和重置时,实际上会发生什么?
【发布时间】:2017-02-23 04:42:00
【问题描述】:

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

  • restore
  • save
  • clear
  • reset

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

我用谷歌搜索了这个,但找不到任何合适的详细答案。

感谢您的任何帮助。

【问题讨论】:

    标签: android ios ionic-framework ionic2 ionic-cli


    【解决方案1】:

    您可以随时查看他们的 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 已从 CLI v3 中删除:插件和平台可以完全由 Cordova 管理。请从您的 package.json 文件中删除 cordovaPlatforms 和 cordovaPlugins 键。如果您使用的是 Cordova 7,请查看有关 Cordova 如何使用 config.xml 和 package.json 管理插件和平台的公告。

    【讨论】:

    • 此命令不适用于新的 CLI,新的 CLI 是什么?
    • 请注意 Github 上的 CLI v3 部分 github.com/driftyco/ionic-cli/blob/…
    • 看起来它是“cordova 插件保存”,并将其存储到 config.xml 而不再是 package.json
    【解决方案2】:

    ionic state restore - Ionic 将添加适当的插件和平台。这对于从源代码控制存储库中检查您的 Ionic 项目的人们来说非常有用。

    ionic state save - 将当前平台和插件存储到package.json

    ionic state clear - 删除所有内容,包括 Ionic 始终安装的默认插件。

    ionic state reset - 这将删除所有内容,然后恢复您在 package.json 文件中指定的内容。

    参考。 - https://www.raymondcamden.com/2015/04/20/ionic-adds-a-new-state-feature

    问候。

    【讨论】:

      猜你喜欢
      • 2020-08-17
      • 1970-01-01
      • 1970-01-01
      • 2022-01-22
      • 2017-09-22
      • 2017-07-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多