[Suggestion] Doesn't Play Well with Mono-Repo Projects (Lerna)
- Dominant language
- TypeScript
- Stars
- 1.1k
- Forks
- 181
- Avg merge
- 6h 44m
- Merged PRs (30d)
- 3
Description
Hello,
Currently our project uses [lerna](https://github.com/lerna/lerna) to manage our mono repo of several sub-packages. So we have the following project structure:
```
root
-- package.json
-- packages
-- -- subPackage1
-- -- -- package.json
-- -- subPackage2
-- -- -- package.json
-- -- etc.
```
However, we "hoist" all of our dependencies so that when we install all the dependencies, the structure looks like this:
```
root
-- package.json
-- node_modules <---- where all of the dependencies are installed for all sub packages
-- packages
-- -- subPackage1
-- -- -- package.json
-- -- subPackage2
-- -- -- package.json
-- -- etc.
```
This means that when I run `electron-rebuild` from the root to try to rebuild a dependency of `subPackage1`, `electron-rebuild` checks the `package.json` inside of `/root` to see if the package is a dependency, and can't find it. This is because it is actually declared as a dependency of `subPackage1` inside of `root/packages/subPackage1/package.json`. That means that I have to add the dependency to the root `package.json` just so that `electron-rebuild` can find it and rebuild it, even though it's in the root `/node_modules/` directory where it is scanning.
It would be great if I could tell `electron-rebuild` what `package.json` to check against when scanning so that I wouldn't have to declare the package as a dependency in my root directory just to satisfy `electron-rebuild`.
Example:
`electron-rebuild --module-dir . --package-json ./packages/app/main/package.json`
Contributor guide
Assessment
This issue has not been assessed yet.