[feature] support for git submodules
See original GitHub issueLerna 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
- remove a package from the monorepo, put it in a separate git repo
- make it a git submodule in the same location of the original monorepo.
- 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:
- Created 3 years ago
- Reactions:15
- Comments:5
Top GitHub Comments
I support this feature request. Submodules do make sense. I want to use it for granular access control to my packages.
https://github.com/mateodelnorte/meta check this out