Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support for local plugin development #716

Open
csabbey opened this issue Nov 1, 2018 · 3 comments
Open

Better support for local plugin development #716

csabbey opened this issue Nov 1, 2018 · 3 comments

Comments

@csabbey
Copy link

csabbey commented Nov 1, 2018

Our app has a few local plugins, and I'm the app-backend developer for our team. I haven't found a great way for our team to keep our plugins up-to-date.

I've used hooks to remove and add these plugins automatically, but the plugin spec tends to get corrupted with this approach. For example, this call:
cordova plugin add --force file:local_plugins/com.rsginc.mobilesurvey
sets the plugin spec to
<plugin name="com.rsginc.mobilesurvey" spec="~1.0.0" />
which isn't a local file spec...

My current approach is to have everyone on my team use the --link option to add these plugins, which works for some changes, but breaks when new source files are added - they don't get copied over.

My thought was that adding versioning to the local file spec could fix this - new versions could be picked up when the source code is updated (and the version is updated in the plugin's package.json) without the need for workarounds like re-adding the plugins or linking them. Admittedly, I'm just a cordova user without a good view into everything that's available, so this might be a naive approach.

... and if there's already a way to handle what I'm trying to do, please let me know.

@dpogue
Copy link
Member

dpogue commented Nov 1, 2018

We're in a transition phase of moving dependency specs from config.xml over to package.json.

I believe what you're trying to do will work if you specify your dependency in package.json:

"com.rsginc.mobilesurvey": "file://local_plugins/com.rsginc.mobilesurvey"

Unfortunately, during this transition phase, Cordova will try to mirror dependencies in both package.json and config.xml, so you might find that it keeps adding it back to config.xml with the wrong spec.

@csabbey
Copy link
Author

csabbey commented Nov 2, 2018

Thanks for this. Any advice on keeping local plugins up to date?

We're getting white screens on app startup, and that seems to be caused by out-of-sync plugins, so I'm running a lot of extra build steps... could all that be caused by linking the local plugins?

I'm starting to think that local plugins just shouldn't be used until at least the next major version of Cordova. Do you know if local plugins will include versioning then?

@brodycj
Copy link
Contributor

brodycj commented Jan 1, 2020

I would say that using local plugins is not supported functionality at this point.

I do think that we should drop using dependencies from config.xml in a new major release and we should improve the consistency with how npm works with dependencies. I forget if we are tracking this somewhere or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants