-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat(cli): locate plugins by allowlist #3762
Conversation
Why wouldn't that work on Android? |
Because we don't have something like it. Some plugins access the config file directly. We could add it to v3, I suppose, but I haven't thought of the implications yet. |
Are you saying |
No, I'm saying it never existed for Android. |
What I mean is our plugins (and likely other plugins) aren't required to use |
🤔 What's this then?
|
I'm definitely all for improving the config API! I have some improvements to contribute. |
It's not used or documented anywhere. 😂 But it should be. Then we can do the |
Yes, there's a bunch of config code that is not documented... and should have been. 😁 I added API to make two things easier:
plugins: {
SplashScreen: {
iosSpinnerStyle: 'small',
iosImageDisplayMode: 'aspectFill',
androidSpinnerStyle: 'inverse',
androidImageDisplayMode: 'aspectFill'
}
} or this: plugins: {
SplashScreen: {
ios: {
spinnerStyle: 'small',
imageDisplayMode: 'aspectFill'
},
android: {
spinnerStyle: 'inverse',
imageDisplayMode: 'aspectFill'
}
}
} You can pass those options to a plugin call in either way as well. |
Don't remove all of the "unused" config code, I'm using most of it. |
I don't see this feature, so users would have to manually handle the plugin list every time they npm install or npm uninstall a plugin? We are working on making the android import automatic so users don't have to do it, but then we make this new thing manual? By the look of the linked issue, it doesn't look like they know which plugins they need on their build pipeline, I don't think this is what they asked for. Also, I wouldn't replace the plugins object to use it as the list, all apps have that object, so all apps would need to be changed, if we go with this, I think it should be better to leave plugins alone and put the list on pluginList or something. But again, I don't see this feature nor think this is what the users who proposed this were thinking about. |
Only if they choose to. We've seen that the "automatic" way of getting this list isn't good enough for some people. This feature would allow people who have many plugins installed to only include some. It would also enable people to include plugins that are dependencies of other packages (not in their
If you're referring to the "app shell" approach here, I think the JS app must know which plugins they need because ultimately they're using them, even if they're transitive dependencies. This is probably not what they asked for, but the changes in this PR will enable their use case and many others. For their approach, they could do something like this. Or they could just pull in all the dependencies from each JS component's
It's a simple change (just rename "plugins" key to "pluginsConfig"), but I get your point. The Capacitor CLI could do this automatically, but I'm not sure how you feel about that. I'm fine renaming the keys to something else, I just figured we could take this opportunity to have the ideal keys. |
I agree that the automatic way is not good enough in some cases, but I don't think this way makes it better for those cases neither, the problem is still there, a package installs a capacitor plugin as a dependency, it's in node_modules but not in the package.json, so it's not detected.
I see both options equally bad. Would be good to have some input from the users who requested/reported this before continuing the work on it. |
If we look at the way most other packages deal with plugins, it's more or less one of two ways:
Of the two, the second is preferable. But, there's a better and completely infallible way to generate the plugin list automatically:
Not easy, but very doable. |
The difference is with a dynamic configuration file, the list can come from anywhere. The users who originally reported this don't know the list of plugins to include during |
We don't want to assume people are using webpack. Our solutions must be general enough to work for everyone. |
True. |
Ok, if you think people can get the list programmatically and use the dynamic configuration file feel free to merge. But I think you shouldn’t use the plugins object for this. |
Per-platform plugin prefs are already supported in the config file, so it follows the plugin list itself might as well allow the same. |
done!
done! |
TODO:
native updates to handle getting plugin config fromplugins
orpluginsConfig
(depends on feat(iOS): Refactoring configuration #3759 and feat(Android): Refactoring configuration #3778)send a warning in the Capacitor CLI for usingplugins
as an objectIntended usage:
If
includePlugins
is not specified, then the old way is used: it looks atpackage.json
for potential plugins.depends on #3756
depends on #3759depends on #3778resolves #3265