Closed emcniece closed 7 years ago
@guyromb thanks for merging this! Sorry to bother you - final needed step is executing npm publish
to ensure that this exists at https://www.npmjs.com/package/net.gsrweb.cordova.plugins.cordovaopennativesettings
This means that you could unpublish https://www.npmjs.com/package/cordova-open-native-settings as well.
@emcniece I changed everything to cordova-open-native-settings, so it will be consistent. Can you confirm if you still have issues?
Thanks
@guyromb Confirmed working!
✗ ionic cordova plugin add cordova-open-native-settings
> cordova plugin add cordova-open-native-settings --save
✔ Running command - done!
Installing "cordova-open-native-settings" for android
Installing "cordova-open-native-settings" for browser
Installing "cordova-open-native-settings" for ios
Adding cordova-open-native-settings to package.json
Saved plugin info for "cordova-open-native-settings" to config.xml
Thanks so much for your help.
Thank you @emcniece
It turns out that while the publish to NPM solved our Ionic/Cordova resolution errors, Cordova has some behaviour where it updates
package.json
with each plugin as a Dependency, along with updatingconfig.xml
with the usual plugin details.Because this repo is published at https://www.npmjs.com/package/cordova-open-native-settings,
npm install cordova-open-native-settings
causes this repo to be added topackage.json
as this:However when Cordova reconciles the plugin repo on npmjs.com (
cordova-open-native-settings
) it adds the plugin ID topackage.json
instead of the NPM repo name, which creates this:This new
package.json
now fails tonpm install
because the plugin ID as a dependency isn't an actual NPM package.I think the plugin needs to be published to NPM as its plugin ID, not as the
package.json
name. To confirm this behaviour, I published the plugin to a private registry:After adjusting my project to pull from this private registry, the install process worked mostly as expected:
... but as you can see, Cordova parses the NPM repo and adds the plugin ID to
package.json
, and in this casenet.gsrweb.cordova.plugins.cordovaopennativesettings
is not a valid repository so if this change gets committed, any build after this point will result in a failure to obtain the plugin.This PR is a 2-step fix for these problems. Contained here are some changes:
package.json
name with plugin ID... and to make this fully functional, this plugin will need to be published to NPM as its plugin ID (
net.gsrweb.cordova.plugins.cordovaopennativesettings
). Now that thepackage.json
name is the same as the plugin ID, the procedure is simplynpm publish
after merging this PR.@guyromb as maintainer of this project, I think it makes sense for you to perform the merge and publish! Please let me know if it's a hassle and perhaps we can publish in a different way.