Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can one prevent gitub repo proliferation with dart packages?

Tags:

dart

dart-pub

Suppose I want to create a colletion of packages, say related to cooking. I'll have a core package called cooking and then I want multiple cooking packages:

  • cooking-mexican
  • cooking-indian
  • cooking-tai

Each of those will use cooking. And maybe more common packages will be created in the future. What is the way to set up this structure in github such that you are not forced to create a separate repo for each, but still allow for client projects to pull just the packages they need.

Can a package reference a path within a github package?

From the pub dependencies page they show how you can reference git:

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

But ideally I want:

dependencies:
  cooking-indian:
    git:
      url: git://github.com/munificent/cooking.git
      ref: some-branch
      # path relative to cooking.git that has pubspec.yaml
      path: cooking-indian

Is there a way to have one github repo with N packages where only some subset can be selected via pub?

like image 388
user1338952 Avatar asked Oct 17 '15 13:10

user1338952


People also ask

What are GitHub dependencies?

GitHub's dependency graph identifies all upstream dependencies and public downstream dependents of a repository or package by parsing manifest files, so that you can better manage the security and compliance of your dependencies. Maya Kaczorowski.

Is Git repository secure?

Here are the main reasons why Git is not secure: There are no authentication or verification measures. You can only control Git with server access. And developers can easily rewrite your change history.

How do I use dependency on GitHub?

Under your repository name, click Settings. In the "Security" section of the sidebar, click Code security and analysis. Read the message about granting GitHub read-only access to the repository data to enable the dependency graph, then next to "Dependency Graph", click Enable.


1 Answers

You can always have a single top level git repository, containing all the packages in sub folders which are published individually. Pub does not mandate that each package be a repo - as long as the individual packages adhere to the pub package layout format.

If you are using private repos you may want to setup a private pub host rather than relying on github for fetching.

However pub currently does not support fetching directly from sub-trees of git repos. If you want to invest effort into implementing this feature you can do so by taking advantage of git's sparse checkout feature.

like image 121
lorefnon Avatar answered Nov 15 '22 05:11

lorefnon