我可以添加基于 Git 分支的 cordova 插件吗?

Can I add a cordova plugin based on a Git branch?

我确实有一个带有 MASTER 分支的 git 存储库。 我现在对同一个 git 项目的特定 BRANCH 有了新的能力。

我想添加特定分支的 cordova 插件。

我知道添加基于 GIT 和 GIT TAGS 的 cordova 项目,但我找不到与分支相关的任何内容。

我正在寻找类似的东西:

cordova plugin add https://mygitadresse/myproject#branch_name 

感谢支持和建议;

如果项目的 github 存储库分支正确,那么您应该能够使用开箱即用的 github 中的特定分支安装插件。

cordova plugin add https://git.example.com/myproject#branch_name 

例如,查看 Cordova connect plugin,其中规定使用 sdk_1.3 分支安装 1.6.0 之前的版本,就像您想要的那样。希望对你有帮助。

如果插件未在 registry.cordova.io 注册,但位于另一个 git 存储库中,您可以指定 git URL:

$ cordova plugin add https://github.com/apache/cordova-plugin-console.git

上面的 git 示例从 master 分支的末尾获取插件,但是可以在 # 字符之后附加一个替代 git-ref,例如标记或分支:

$ cordova plugin add https://github.com/apache/cordova-plugin-console.git#r0.2.0

如果插件(及其 plugin.xml 文件)位于 git 存储库的子目录中,您可以使用 : 字符指定它。请注意,# 字符仍然需要:

$ cordova plugin add https://github.com/someone/aplugin.git#:/my/sub/dir

您还可以合并 git-ref 和子目录:

$ cordova plugin add https://github.com/someone/aplugin.git#r0.0.1:/my/sub/dir

Reference: https://cordova.apache.org/docs/en/3.3.0/guide/cli/index.html