pd4d10 / unpub

Self-hosted private Dart Pub server for Enterprise
https://pub.dev/packages/unpub
MIT License
439 stars 136 forks source link

Enhancement: Cache/proxy upstream dependencies #32

Open dellgreen opened 3 years ago

dellgreen commented 3 years ago

To save/shared team enterprise internet bandwidth, it would be a nice feature (like in other programming languages) that already downloaded public packages are stored on the local enterprise unpub server rather then downloaded from the internet again.

However it appears that the way dart pub works its not super straight-forward as the version of the package is not included in the initial query that requests all versions. This means that the upstream connection to get an updated list of versions is still required to provide to dart pub tool, but the urls of the supplied json will need to be changed to point back to the local enterprise unpub server for downloads to ensure download request go thru the local server.

The download api does contain the required version, so when a following download request is received, download/cache and serve the package archive back to the client.

pd4d10 commented 3 years ago

Yeah, this could a useful feature.

Could it be implemented with a customized package store?