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

Bug in after_plugin_add hook script #252

Open
rsippl opened this issue Oct 4, 2015 · 1 comment
Open

Bug in after_plugin_add hook script #252

rsippl opened this issue Oct 4, 2015 · 1 comment

Comments

@rsippl
Copy link

rsippl commented Oct 4, 2015

hooks/after_plugin_add/register_plugins.js is supposed to make sure that for a "cordova plugin add ...", a line is added to package.json, more precisely, to the cordovaPlugins array. A "ionic state restore" is able to install all plugins from the cordovaPlugins, e.g. after you check out your app from a git repo that doesn't contain the plugins directory.

There's a check in register_plugins.js that is supposed to make sure that cordovaPlugins doesn't contain duplicates. Here's how the check is being currently done:

if (packageJSON.cordovaPlugins.indexOf(plugin) !== -1) {
  packageJSON.cordovaPlugins.push(plugin);
}

"!== -1" should read "== -1". This bug causes only those plugins to be added to package.json which are already in there. If you add a new plugin, package.json won't be changed. You can add plugin entries manually, but every "ionic state restore" call (which internally calls "cordova plugin add ..." for all plugins in package.json) will duplicate the plugins list.

@davidachee
Copy link

+1

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

No branches or pull requests

2 participants