Open jonas-lauber opened 6 years ago
I'll help you running tests in #4 :v:
@jonas-lauber I think we can close this one?
Should we add some filters, like include
and exclude
to include root packages or exclude packages?
@Aqours what do you mean exactly?
@nicojs
17:45:06 (5012) INFO ParentBinLinker Linking dependencies ["@commitlint/cli","@commitlint/config-conventional","husky","lerna","link-parent-bin","ts-loader","tslint","typescript","webpack","webpack-cli"] under children ["base-1","demo","test"]
17:45:06 (5012) INFO link Link at 'packages\base-1\node_modules\.bin\lerna' already exists. Leaving it alone.
17:45:06 (5012) INFO link Link at 'packages\demo\node_modules\.bin\lerna' already exists. Leaving it alone.
17:45:06 (5012) INFO link Link at 'packages\test\node_modules\.bin\lerna' already exists. Leaving it alone.
17:45:06 (5012) INFO link Link at 'packages\base-1\node_modules\.bin\link-parent-bin' already exists. Leaving it alone.
17:45:06 (5012) INFO link Link at 'packages\demo\node_modules\.bin\link-parent-bin' already exists. Leaving it alone.
17:45:06 (5012) INFO link Link at 'packages\test\node_modules\.bin\link-parent-bin' already exists. Leaving it alone.
17:45:06 (5012) INFO link Link at 'packages\base-1\node_modules\.bin\tslint' already exists. Leaving it alone.
This package link every binary to sub-project, but these packages(["@commitlint/cli","@commitlint/config-conventional","husky","lerna","link-parent-bin","ts-loader"]
) seems unnecessary symlink.
I just moved my project to Mac yesterday (was using Windows before) and I ran into another small problem (not blocking though). In have 2 dependencies importing the same bin (jest and jest-cli both importing .bin/jest.js) The first time I run the command I get ugly exception from the symlink command.
The second time everything works fine and I get the expected warning.
For what I saw this is because everything runs asynch and they both do the check before the symlink is actually done. Then the first do it and everything goes fine and the second tries and it fails. What I did by me, is to systematically call symlink and if it fails checkout why it failed. => https://github.com/jonas-lauber/node-link-parent-bin/commit/211fed660cc3bdf0d64f62ef1bcee48f35f7bea6 A small optimisation would be to check if to exists first to handle the case where it was created by a previous run (the case where the same run has multiple times the same bin remains).
Something like:
But I am actually not sure it is much more efficient... So I kept it simple.
Once again, I would love to make a PR and not do my stuff in a fork, but my skills lack to do the tests properly...