mreichelt
mreichelt

Reputation: 12455

How to set up a mirror/company-wide cache for Dart/Flutter packages?

Is there a way to set up a company-wide cache for pub.dev packages, without needing to mirror the entire pub.dev repo?

I've seen there is a community-contributed pub_mirror package. But that one downloads the entire pub.dev, which is complete overkill.

There seemed to be a pub_server package from Google itself, which has an example.dart that seemed to do what I want:

An experimental pub server based on a file system can be found in example/example.dart. It uses a filesystem-based PackageRepository for storing packages and has a read-only fallback to the real pub.dartlang.org site, if a package is not available locally. This allows one to use all pub.dartlang.org packages and have additional ones, on top of the publicly available packages, available only locally.

But that one is archived, experimental, and not contributed to anymore. So how do I cache pub packages company-wide then?

Thanks a lot for your help! :-)

Upvotes: 4

Views: 645

Answers (1)

jeroen-meijer
jeroen-meijer

Reputation: 2974

Only thing I can think of that comes close is this.

You can host your packages privately on GitHub and give everybody who needs them access.

Put something like this in your pubspec.yaml.

dependencies:
  kittens:
    git:
      url: git://github.com/munificent/kittens.git
      ref: some-branch

Upvotes: 1

Related Questions