Add --incremental
option to hex.registry build
#920
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello folks 👋🏼
This PR is primarily for discussion purposes. The code is for demonstration, but I welcome all feedback.
The
mix hex.registry build
command is great for managing local package registries. Thank you for implementing it. Occasionally we want to add a package (or package version) to a registry without regenerating the entire registry. For example, if we build a package.tar
in a CI job and want to publish it to a local registry, it might be difficult to download all of the existing tarballs prior to building the registry.Perhaps there is a way around this. If so, great! No need for this PR. If there isn't, maybe this could help.
This PR implements an
--incremental
option formix hex.registry build
. When this option is enabled, it adds new packages to a registry without removing any existing packages. Thus, if you have a single tarball inPUBLIC_DIR/tarballs
, then a single package will be added (or updated). All existing packages remain. The CI job could then re-upload thenames
,versions
, andpackages/X
files along with the new tarball.At the time of writing there are two commits with two variations of an implementation. The first keeps the incremental logic separate in a separate function. The second attempts to integrate it with the existing function. I welcome feedback on everything. 🙂
Thank you for everything you do in the community!