[WORKSPACE] Monorepo packages/apps dependencies managements
MatthD opened this issue · comments
Description
So I have a project, we did used typescript path aliases
in the past so that our apps
can load our packages
.
We would go with Bit be able to have a link between our packages-apps
When doing bit install
via pnpm behind , it add my local packages into the node-modules;
BUT it appears that it create symlink PER every files (not on the directory)
So that if I had to add new file/rename one/remove one I need to bit install
so that I can saw the new file.
BUT ! It keep the file removed from my packages, and it also keep the renamed file + the new renamed.
That's not a good dev experience, so I may be wrong in term of usage, could you help?
Specifications
- Bit version: 1.6.126
- Node version: 20.11.0
- npm / yarn version: 10.2.4
- Platform: Mac0s 14.4.1
- Bit compiler (include version): pnpm
for generating the local module links you can simply run bit start
or bit watch
and bit will refresh the node-module links.
essentially this runs bit link && bit compile
, which only care about the module link generation.
as for removed files and their links or dists, at the moment we don't have a good solution for this.
Thanks for your answer. ! But why Bit is creating a per file symlink ? I mean a symlink that point to folder will prevent this kind of thing no ?
Is it related to pnpm ?
the node-module link is there to mimic the component as if it was an external dependency, and as such, has additional generated files that are not just the source code (like the dist
directory or even the auto-generated package.json
).
if bit would have symlink the entire directory, and it would then try to generate files, these files would appear as part of your source code. and that is something we don't want.
the goal is for a component to have all the APIs for others to use from your index
file, not for you to directly import internal implementation details from your components.
you only need to have bit watch
(or even bit start
) run in the background, and on every change you get the compiled outputs to your dist
(which is pointed to from the package.json
). so other services/components can safely depend on your component.