cordova-docs icon indicating copy to clipboard operation
cordova-docs copied to clipboard

Document how to install branch of Github repo / PR as platform/plugin

Open janpio opened this issue 7 years ago • 5 comments

I couldn't find any documentation on how to install a branch of a Github Repo (e.g. a PR to one of the Cordova plugins). This should probably be added to https://cordova.apache.org/docs/en/8.x/platform_plugin_versioning_ref/index.html which explains how to install paths, versions etc.

janpio avatar Jul 19 '18 10:07 janpio

Using a # to separate the branch name from the repo URL worked:

cordova plugin add https://github.com/dudeofawesome/cordova-plugin-statusbar.git#CB-12024cordova-plugin-statusbar

results in package.json:

"dependencies": {
        ...
        "cordova-plugin-statusbar": "git+https://github.com/dudeofawesome/cordova-plugin-statusbar.git#CB-12024cordova-plugin-statusbar",
        ...
    },

janpio avatar Jul 19 '18 10:07 janpio

It should work exactly like for any npm package AFAICT. So if we add something, we might be able to reference the npm install docs.

raphinesse avatar Jul 19 '18 10:07 raphinesse

Surprisingly https://docs.npmjs.com/cli/install doesn't mention "branch" at all. But I think #branchname is Git repo convention, correct?

janpio avatar Jul 19 '18 10:07 janpio

The docs you linked to refer to it as #<commit-ish> since you can specify a tag or a commit hash too.

raphinesse avatar Jul 19 '18 10:07 raphinesse

Ugh, ok.

I think we're better of making it explicit in the Cordova docs then - as it is a pretty common thing for people wanting to check out a PR branch.

Still, adding a link to the underlying functionality docs (if this is really "just" powered by npm install) is probably also a good idea.

janpio avatar Jul 19 '18 10:07 janpio