Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run a private pub server while still referencing packages from pub.dartlang.org?

Tags:

dart

dart-pub

Assuming that I'm running my own instance of pub-dartlang for a private pub feed; how do I indicate in pubspec.yaml which packages come from the private feed vs pub.dartlang.org?

like image 542
Danny Tuppeny Avatar asked Oct 31 '14 15:10

Danny Tuppeny


People also ask

How do you override dependencies in flutter?

You can use dependency_overrides to temporarily override all references to a dependency.

How do I publish a package to a pub developer?

Open the console, move to the root of your project (the same folder as the pubspec file) and run flutter format . if you haven't already. Run the flutter pub publish command. Type 'y' when prompted and then open the link generated by the console to confirm and validate your package publish.

How do I run a pub in Terminal?

Run flutter pub get in the terminal, or click Packages get in IntelliJ or Android Studio. Run the app (or stop and restart it, if it was already running before adding the plugin). Click Show Flutter homepage. You should see the default browser open on the device, displaying the homepage for flutter.

Where is pub cache stored?

Some of pub's dependencies are downloaded to the pub cache. By default, this directory is located under . pub-cache in your home directory (on macOS and Linux), or in %LOCALAPPDATA%\Pub\Cache (on Windows). (The precise location of the cache may vary depending on the Windows version.)


1 Answers

You can set the environment variable PUB_HOSTED_URL so it points to your custom pub repo server. This way pub loads all packages which don't have a server specified from this server.

You can define exceptions in pubspec.yaml like

dependencies:
  transmogrify:
    hosted:
      name: transmogrify
      url: http://some-package-server.com

see https://www.dartlang.org/tools/pub/dependencies.html for more details.

There is another package that seems to provide a custom Pub repo https://pub.dartlang.org/packages/pub_proxy_server

like image 137
Günter Zöchbauer Avatar answered Oct 08 '22 12:10

Günter Zöchbauer