Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add support for git-hosted urls as sibling package dependencies #1033
This PR introduces optional support for package dependency version to be stored as url to git hosted repositories in
Motivation and Context
Lerna assumes packages to be distributed on npm upon publish. However, when private repo is not an option, packages can be distributed on private GH repositories.
We run a private Github Lerna monorepo with Ember addons and we publish our packages to separate read-only repositories, from which addons are installable separately (and can bring in other subpackages as dependencies).
With versions written down as
This PR shares the work we've done with @synaptiko to streamline this process. We've done our best to make it least invasive. We are open to improvement suggestions to make it even more suitable for inclusion in Lerna.
How Has This Been Tested?
We run code from this PR internally to bootstrap and publish our monorepo. We have also updated Lerna tests to cover added code.
Types of changes
evocateur left a comment
This PR was well-constructed from the get-go, please don't take the number of (mostly minor) comments as implicit criticism! I appreciate the care and attention to detail already in evidence.
Beyond stylistic issues, I think my biggest concern is keeping consistent with our "durable" options pattern (allowing CLI flags to override "embedded" config in lerna.json). As rare as I expect this particular pattern to be, I want to keep these configuration options as consistent as possible.
For the future reference, there are multiple ways how to achieve "git-only" distribution from monorepo.
We've tried both of those:
Both are quite fast, splitsh is faster (we have less then 200 commits though) and both require to have prepared "downstream" repositories in advance. There is one bummer with
@mattbrunetti It was easier for us to setup this than to manage private npm repository (which requires every developer to setup his npm/yarn accordingly).
@synaptiko I have one major confusion regarding all this. Please help me clear it:
"This PR only allows putting versions as git urls. That's all. Pushing individual packages to downstream git repos has to be still handled on our own (using splitish etc)."
Am I correct on this?
* Support gitRange (#semver:^1.2.3) as well as gitCommittish * Move dependency update logic into Package#updateDependency() * Test PublishCommand/normal-exact with meaningful fixtures BREAKING CHANGE: * Remove --use-git-version and --git-version-prefix options The former is now implied, and the latter is always "" or "v". Updating git hosted versions no longer throws when --exact is missing. * Remove VersionSerializer, GitVersionParser We now simply recognize any local package name with a matching git url. refs #1033
As a side tip, I'm experimenting with this tool with git hooks/husky:
Seems like doing the job well without the need to keep repositories read-only. The only gotcha was I needed to filter my git hooks for the only root origin in order to get rid of endless push/pulls