Publishing Packages
Permissions
Only Uploaders may publish a package. Each edition of OnePub defines an Uploader differently.
As all Members are Uploaders any Member can create a new package by running 'dart | flutter pub publish'.
All packages are associated with the Default Team and as such all Members have access to the package.
The secret to successfully publishing a package is.... good documentation.
Add a readme.md, take some time to document your public API and throw in some examples.
Security
The largest risk you face is accidentally publishing your package to pub.dev.
Publishing
If this is your first time publishing a package then you might find our blog article on publishing useful:
Mark package as private
To prepare a package for uploading to OnePub you must mark it as a private package.
Run the onepub pub private
command:
This has the effect of adding a publish_to
key to your pubspec.yaml
file. The publish_to
instructs dart to publish you package to OnePub rather than pub.dev.
And now publish your package to OnePub:
Note: you can add the publish_to key manually by following the hard way instructions.
Public Packages
Some of your team members may need to publish both private and public packages.
All public packages should be published directly to pub.dev using the standard dart tooling/processes.
Public packages you upload to pub.dev will be cached on onepub.dev within a few minutes of you publishing to pub.dev, so you can easily find these packages on OnePub as well as pub.dev
Teams
If your OnePub organisation has multiple teams (you need the Team or Enterprise license) then are some additional steps required when uploading a package.
The core issue is that you need to nominate the team the package belongs to before uploading the package.
A package may be associated with multiple teams.
To associate a package with a Team
Navigate to My OnePub | Managed Packages
Create a new package
Enter the package name and description.
On the Teams tab, select each of the teams the package is associated with.
Save the new package.
You can now publish your package from the CLI as per the normal process.
Last updated