git Cordova 从 config.xml 安装平台/插件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33097083/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 11:27:01  来源:igfitidea点击:

Cordova install platforms/plugins from config.xml

gitcordovaversion-controlconfig

提问by Vincent Wasteels

In Cordova, it is possible to save platforms and plugins into the config.xmlfile, this way :

在 Cordova 中,可以通过以下方式将平台和插件保存到config.xml文件中:

cordova platform add <platform> --save
cordova plugin add <plugin> --save

This is usefull for versioning in order to not commit all this generated files.

这对于版本控制很有用,以便不提交所有这些生成的文件。

But... how can I install them back from config.xml?

但是......我怎样才能安装它们config.xml呢?

Something like : cordova platform add --source=config.xml?

类似的东西:cordova platform add --source=config.xml

回答by daserge

Upd: Official docs on this topic: http://cordova.apache.org/docs/en/latest/platform_plugin_versioning_ref/index.html

更新:关于这个主题的官方文档:http: //cordova.apache.org/docs/en/latest/platform_plugin_versioning_ref/index.html

Here is some docs on this feature from Tools Release: April 21, 2015:

以下是2015 年 4 月 21 日工具发布中有关此功能的一些文档:

When adding plugins or platforms, use the --save flag to add them to config.xml.

Ex: cordova platform add android --save.

Existing projects can use cordova plugin saveand cordova platform savecommands to save all previously installed plugins and platforms into your project's config.xml.

Platforms and plugins will be autorestored when cordova prepare is run. This allows developers to easily manage and share their dependenceis among different development enviroments and with their coworkers.

添加插件或平台时,使用 --save 标志将它们添加到 config.xml。

例如:cordova 平台添加 android --save。

现有项目可以使用cordova plugin savecordova platform save命令将所有以前安装的插件和平台保存到项目的 config.xml 中

运行cordova prepare时将自动恢复平台和插件。这使开发人员可以轻松地管理和共享他们在不同开发环境之间以及与他们的同事之间的依赖关系。

回答by Adam

To install all plugins fromthe config.xml file you run:

要安装的所有插件运行config.xml文件:

cordova prepare

cordova prepare

Check what plugins are loaded with:

检查加载了哪些插件:

cordova plugin list

cordova plugin list

回答by Lakshay Sharma

Run the command in your dir of outside www folder

在外部 www 文件夹的目录中运行命令

$ cordova platform add ios - for adding ios platform
$ cordova platform add android- for adding android platform
$ cordova platform add blackberry10
$ cordova platform add firefoxos

回答by Vincent Wasteels

Apparently running a command like cordova servewill automatically add all missing platforms/plugins !

显然运行一个像这样的命令cordova serve会自动添加所有缺少的平台/插件!