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:
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?
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With