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

时间:2021-01-26 07:27:18

In Cordova, it is possible to save platforms and plugins into the config.xml file, 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?

2 个解决方案

#1


26  

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

Upd:关于此主题的官方文档: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.

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

Ex: cordova platform add android --save.

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

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

现有项目可以使用cordova插件save和cordova平台保存命令将所有以前安装的插件和平台保存到项目的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.

运行cordova准备时,平台和插件将自动存储。这使开发人员能够轻松地管理和分享他们在不同的开发环境和他们的同事之间的依赖性。

#2


-1  

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

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

#1


26  

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

Upd:关于此主题的官方文档: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.

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

Ex: cordova platform add android --save.

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

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

现有项目可以使用cordova插件save和cordova平台保存命令将所有以前安装的插件和平台保存到项目的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.

运行cordova准备时,平台和插件将自动存储。这使开发人员能够轻松地管理和分享他们在不同的开发环境和他们的同事之间的依赖性。

#2


-1  

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

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