Description
We have forc.pub ready, and with #7038 forc also can work with published packages. We should have a forc publish
plugin which will resolve the dependency order in a package/workspace and deploy the member packages in the correct order.
For standalone packages this is trivial because there is only one package to publish. We have this version of forc-publish plugin already implemented in #6890.
For workspaces things get a little bit interesting:
In a workspace it is highly likely that we will deploy multiple members and these members reference each other. The published packages cannot depend on each other by path, so we should publish the first package and update the manifest of the packages depending on that first package to point to this newly published new version.
This ordering problem is the same as deciding on the compilation order of the packages. We need to publish packages without any dependency (on member packages) first and always make sure that the a package to be published has all its dependencies (member package dependencies to be concise) to be already published. That means we need to do a topological sort on the build plan to get the correct order of deployment.
The reason we need to do this is basically a verification done in forc.pub. We want to minimize ways that functioning packages populating our registry so forc.pub makes a verification step to ensure the package being published actually can be built. This creates an constraint on publishing step to ensure each child member package is actually deployed before their parents.