-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: Nested Local Dependency Installation (via hoisting?) #41
Comments
Thanks for the kind words.
If I understand you correctly, then yes, this is the best solution. This is what I do for StrykerJS as well: For example: {
"localDependencies": {
"@stryker-mutator/api": "../../../packages/api",
"@stryker-mutator/core": "../../../packages/core",
"@stryker-mutator/instrumenter": "../../../packages/instrumenter",
"@stryker-mutator/karma-runner": "../../../packages/karma-runner",
"@stryker-mutator/util": "../../../packages/util"
}
} Where Is this what you mean? I think it is very difficult to improve this because this is how |
Yup, exactly! :) I can't claim to be an npm expert, but I was wondering if install-local could solve this. I imagine the install-local algorithm becoming somewhat recursive, like:
normalizePath() would output the path of the tdep relative to the package where install-local is run, which both removes the most tedious part of the manual hoisting (changing the paths) and solves dep disambiguation (what if two libs have same util is local dep under different names or something). I suggest the separate transitiveLocalDependencies field because this could be cleaned/reinstalled more brazenly than entries in localDependencies You might have more insight into the difficulties than I do. From my side this is the last remaining functionality to make this library a full local-build solution on top of npm, which would be awesome. It still amazes me that this logic isn't native to npm, it's super useful :) |
Hi! Thanks so much for this package, it seems to be the only public solution for actually copying local packages into their clients' node_modules folder. Super useful for testing. I'm actually planning to use it in a production monorepo + microservices layout where the microservice bundling requires all dependencies to be in a single directory subtree (no symlinks to a global
util
folder or something).One limitation I've discovered is that nested local dependencies don't currently work. That is, if local package App depends on local package Lib that depends on local package Util,
npx install-local path/to/Lib
won't pull in Util as well. I imagine this is because runningnpm pack
on Lib doesn't bundle the Util dependency and adding the Lib tarball to Client doesn't respect the (custom) localDependencies field in lib/package.json (or associated tarball).Possible solutions:
npm install
in the Lib package fail with "No valid versions available for Util." This happens even if install-local is run in npm's preinstall hook, I assume because npm install cleans out all dependencies not inpackage-lock.json
from node_modules/ , andpackage-lock.json
isn't updated when install-local adds local dependencies.It seems like this would be relatively easy to do as part
install-local --save
, although we'd have to be careful about messy/invalid/circular dependency trees. But it would make this solution a little more fully fledged. npm would continue to beautifully handle all the non-local dependency resolution (hoisting shared versions, installing nested local versions, etc).I'm super psyched to have discovered this package and would love to hear what people more familiar with the package think of this idea!
The text was updated successfully, but these errors were encountered: