The ionic-cli is not saving the variables to package.json on plugin add
Plugin variables aren't being saved to the package.json after running ionic plugin add submodules/phonegap-facebook-plugin --variable APP_ID=SOMEID --variable APP_NAME=someName.
I checked the source of State in ionic-app-lib and it takes a variables arguments (source), but the ionic-cli does not pass it along (source).
Nice catch. I'll patch it today. Thanks for reporting!
@maksymilian-majer Mind double checking for me - npm install -g ionic@beta
The beta version should be passing along variables now.
@jbavari I checked it and it works as expected :+1:
Awesome. I'll merge this into master and be pushing it out later. Thanks again for reporting!
No problem. You're doing amazing work with ionic, glad to be helpful!
I ran into the same issue. I'm using CLI 1.5.5
ionic plugin add cc.fovea.cordova.purchase --variable BILLING_KEY="SOME_BILLING_KEY"
Ran into this issue today using CLI 1.5.5 as well when I tried:
ionic plugin add https://github.com/Telerik-Verified-Plugins/Stripe --variable API_KEY=STRIPE_SECRET_API_KEY
Note, I'm assuming that this thread is reporting that when you use the --variable flag, the variable doesn't get saved to the root package.json so you can use ionic state restore on other team's machines, build boxes, etc.
I tried npm install -g ionic@beta and it didn't work there either.
in my experience trying to use this with the facebook plugin i discovered that ionic add does edit the package.json correctly, however a restore or even a reset does not install the plugin correctly. the facebook plugin directly actually becomes completely empty. i did use the http url. for now I am installing the plugin via bash script immediately after ionic restore
The facebook plugin is an exception as you need to have a copy of it locally in order for it to install: https://github.com/Wizcorp/phonegap-facebook-plugin#-----cordova-registry-warning-ios
On Thu, Jul 9, 2015 at 12:14 AM, Keyvan Fatehi [email protected] wrote:
in my experience trying to use this with the facebook plugin https://github.com/Wizcorp/phonegap-facebook-plugin i discovered that ionic add does edit the package.json correctly, however a restore or even a reset does not install the plugin correctly. the facebook plugin directly actually becomes completely empty. i did use the http url. for now I am installing the plugin via bash script immediately after ionic restore
— Reply to this email directly or view it on GitHub https://github.com/driftyco/ionic-cli/issues/429#issuecomment-119852396.
i would argue that because the locator attribute is set to a git repository, it is expected that under the hood ionic would locally clone the repo down and try to add it, thereby complying with that warning.
Ionic: v1.6.4 Cordova: v5.1.1
It isn't working, when I tried to add the google plugin.
Command: ionic plugin add ionic plugin add https://github.com/EddyVerbruggen/cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=CLIENT_ID
And below was the result in package.json, variables object is pretty much empty
"locator": "https://github.com/EddyVerbruggen/cordova-plugin-googleplus", "id": "cordova-plugin-googleplus", "variables": { "": "" }
@peek4y I believe you are running into the same issue I was having with using --variable. See https://github.com/driftyco/ionic-app-lib/pull/26 for the details and a possible solution.
Hi @maksymilian-majer @jbavari
Just a quick question. This has been closed but I'm not sure if this resolved. If I add a plugin with variables, it saves to config.xml but not to package.json
Is it supposed to work that way and do we need to add the plugins and config to package.json manually? For example:
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"ionic-plugin-keyboard",
{
"id": "cc.fovea.cordova.purchase",
"locator": "https://github.com/j3k0/cordova-plugin-purchase.git",
"variables": {
"BILLING_KEY": "SOME_KEY_VALUE"
}
},
{
"id": "cc.fovea.plugins.newsstand",
"locator": "https://github.com/j3k0/PhoneGap-Newsstand-iOS.git"
}
]
Thank you for your input.
With the command ionic state save the plugins are saved to config.xml
But the variables are ignored. Is that okay?