question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[feature] support for git submodules

See original GitHub issue

Lerna v3.20.2

I tried running lerna version, accepted all default answers, and eventually hit this:

Current Behavior

lerna ERR! Error: Command failed: git add -- packages/cli/package.json packages/cli/package-lock.json packages/live-code/package.json packages/live-code/package-lock.json packages/docsifyjs+docsify/package.json packages/docsifyjs+docsify/package-lock.json packages/variable/package.json ... etc ...
lerna ERR! fatal: Pathspec 'packages/cli/package.json' is in submodule 'packages/cli'

Expected Behavior

I was hoping it would work with git submodules.

For various reasons, I have all my packages as git submodules. Basically I want to have an “umbrella repo” and not a “monorepo”.

Steps to reproduce

  1. remove a package from the monorepo, put it in a separate git repo
  2. make it a git submodule in the same location of the original monorepo.
  3. try to run any commands that you’ve already been running

Some commands won’t work, like the lerna version example.

Possible Solution

Maybe Lerna can detect submodules, and instead of adding the files it modified, it would cd into the submodules and call git add inside of them, and make individual version commits in each submodule.

Workaround

For now, I can run lerna run release:patch and just have the release:patch script in each package do the work (or similar with release:minor, etc). Lerna is still great at running the commands across all the packages.

I’m enjoying Lerna with my git submodules! I’ve been using it to run builds and tests across all of my packages, which was the original goal that I was looking to achieve, and Lerna had enough features to make that work in a nice way (alternative tools do not work well with git submodules at all, or didn’t have the features I was looking for, namely Rush.js).

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:15
  • Comments:5

github_iconTop GitHub Comments

8reactions
dilamecommented, May 18, 2020

I support this feature request. Submodules do make sense. I want to use it for granular access control to my packages.

3reactions
deviprsdcommented, Aug 27, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Git - Submodules - Git SCM
Git addresses this issue using submodules. Submodules allow you to keep a Git repository as a subdirectory of another Git repository. This lets...
Read more >
Git submodule - Atlassian
A git submodule is a record within a host git repository that points to a specific commit in another external repository. Submodules are...
Read more >
Using Git submodules with GitLab CI/CD
Use Git submodules to keep a Git repository as a subdirectory of another Git repository. You can clone another repository into your project...
Read more >
Working with submodules - The GitHub Blog
Eventually, any interesting software project will come to depend on another project, library, or framework. Git provides submodules to help ...
Read more >
Git Submodule Guide & Basic Commands to Get Started
A Git submodule is a feature that allows the integration of multiple independent repositories into a single project. A submodule acts as a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found