fix: When you try to publish your final plugin a lot of undocumented steps are required
Description Currently the generated flutter plugin works so far fine while development (except a couple of possible improvements like #42, #43, #44). However when you try to publish it at least as git dependency (as some kind of preview) you will notice quickly that there are a lot of "path: ../xyz" dependencies which simply won't work. This should be mentioned at least or might be some help how to manage this.
Steps To Reproduce
- Create the flutter plugin
- Add all the features you want
- Try to add your plugin as a dependency in a flutter app
Expected Behavior The plugin should work
Actual Behavior The plugin cannot be resolved since the ".." dependencies are unknown.
Hi @rekire thanks for opening this issue 🙌
I think you are referring to ".." dependencies as those path dependencies.
How are you adding the plugin into your flutter application?
Sorry for the late reply, right now I'm adding it as git dependency. But I'm right now on the way to publish it on pub.dev. Since I'm also changing my platform interface before the 1.0.0 I notices that tagging it with a real version makes it also more complicated since you need to keep in mind that the interface it has its own version. Hints for that might be good too
When publishing to pub.dev it will most likely complain about path dependencies.
I recommend reading the official documentation for publishing, let me know if such documentation helps out.
I think it wouldn't hurt to include a "Publishing your plugin" section in the generated template within a "CONTRIBUTING" file based on the generation. Would you be interested in writing such documentation?
I'm working on my first update since the initial release. So I can write here down the steps when I fixed my CI issues, which I want to mention in a new issue.
However I don't have the time right now to extend the documentation itself.
I published now my 1.0.1. When you have fixed everything so that dart pub publish --dry-run has no warnings then you need to run those commands:
cd plugin_name_platform_interface
dart pub publish
cd ../plugin_name_android
dart pub publish
cd ../plugin_name_darwin# (or _ios and _macos if you use multiple packages)
dart pub publish
cd ../plugin_name_linux
dart pub publish
cd ../plugin_name_web
dart pub publish
cd ../plugin_name_windows
dart pub publish
cd ../plugin_name
dart pub publish
Keep in mind that you likely need to publish the platform_interface first since the other packages depend on it. Then publish the platform specific plugins and at the end the package which is used by the users.
Thanks @rekire for writing your insights down.
I think it might be useful to include documentation within the template CONTRIBUTING and/or a script within the template under a tool directory named publish that would handle the publishing order and updating dependency constraints. Not sure if existing tools like melos are already capable of handling such.