Provide the batch SDK plugin in a separate repo
fephil opened this issue · 14 comments
Hi,
It would be great if the Batch SDK was available in a separate repo so my team wouldn't need to manually download the plugin to drop it into the build. It would mean the following would work in config.xml:
<plugin name="com.batch.cordova" spec="https://github.com/BatchLabs/[sdk-name].git" />
Thanks!
Hello!
Thanks for the suggestion. We'll think of a solution.
We usually advise developers to use the subdirectory feature, but it looks like it has been deprecated, so we'll have to make a new repo.
In the meantime, cordova plugin add https://github.com/BatchLabs/cordova-plugin.git#:SDK/batch-cordova-plugin
should do the trick
I can confirm that the above url works. Thanks for replying so quickly.
Hi @abarisain.
Cordova 7 has just been released so this is a higher priority then it once was. Can the plugin be moved into a separate repo?
Cheers.
Well, first I'll have to check if the plugin still works okay with Cordova 7 :)
But sure, we'll look at it.
Quick update:
Looks like cordova 7 broke more than that, as plugins are now required to have a package.json.
Since Cordova 7 added breaking changes with not much of a warning, we'll proceed carefully, and make sure everything in the SDK works before officially stating that we support Cordova 7
The good news is that NPM publishing has been made easier, and we'll give it a shot :)
Hello!
Rather than creating a new repo, we published the SDK on npm. Note that the npm page is currently pretty empty, we'll take care of that later.
Integrating the sdk should be as simple as doing cordova plugin add batchsdk-cordova
Also, Cordova 7 is still untested with Batch, so we're not supporting this officially. Please do not hesitate to report any bug you encounter with the support team.
@abarisain Thanks for looking into this so quickly.
Hi @abarisain,
After using the above command, when using Cordova 6.5.0, I'm getting the following error when running cordova prepare:
Failed to restore plugin "com.batch.cordova" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin com.batch.cordova@1.
7.4 via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: Registry returned 404 for GET on https://registry.npmjs.org/com.batch.cordova
Oh, I didn't know that cordova's plugin name had to match npm's
Also FYI, I noticed the npm search for "batch sdk" came up with this, which is definitely not from yourselves! https://www.npmjs.com/package/batch-cordova-plugin
Thanks for the heads up, we're aware of this package, and we'll try to get in touch with the author to remove it, since we now have an official one :)
Also, I suggest that we forget that batchsdk-cordova
has ever existed: The plugin has been republished as com.batch.cordova
. It's not a very usual name for an npm package, but I don't want to change the plugin ID, as this might cause headaches to developers who integrated the SDK with other solutions.
cordova plugin add com.batch.cordova
should work.
I can confirm the above command works on Cordova 6.5.0 (not been able to test v7 yet).
Thanks for sorting so quickly.
Note: I edited my previous post, I meant "com.batch.cordova" rather than "batchsdk-cordova" in the fixed command.
batchsdk-cordova will be deleted.