yalc: Doesn't work with dependency of dependency
Supposing I have a main project A which has a dependency on Project-B, which in turn has a dependency on Project-C. Both Project-B and Project-C are managed as yalc dependencies.
npm install
throws an error such as:
Could not install from ".yalc/project-b/.yalc/project-c" as it does not contain a package.json file.
When installing the reference to project-c
, the project-b
.yalc
folder is the same as usual file:.yalc/project-c
- however, this is then attempting to reference the dependent project within the project copied to the .yalc
folder, however, it should be referencing the yalc folder from the root of the .yalc
in project-b
instead.
Basically, if you have a project in your .yalc
folder that references another project in the .yalc
repository, then it will incorrectly assume the referenced project is at the same level, when it should be looking to the root yalc folder in the parent project (i.e. project-a/.yalc
)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 53 (20 by maintainers)
@whitecolor can we re-open this please? Looks like ppl are still having problems. See comment from @yang for reproducible steps. Thanks!
I’m running into the same issue.
I have a project A depending on a project B which depends on a project C.
I ran:
I’m using the latest yalc version 1.0.0-pre.27.
I do not see any nested .yalc directory inside
...A/.yalc/B
.I did this with a pretty simple project setup, but let me know if you are unable to repro for some reason.
I solved my issue with this using
resolutions
.the problem is that yalc should handle that itself, it should not require the user to add ‘.yalc’ to the list of npm published files. Users should not be publishing files to npm which are specifically meant for local development
For what it’s worth, this is the main reason I created my “wrapper around yalc” that I named zalc: https://github.com/Venryx/zalc
Basically, it monkey-patches yalc so that when you run
zalc publish/push
, it adds the files in the being-published module’s.yalc
folder as part of its yalc-published contents (after adding a!.yalc/**/*
line to the.yalcignore
file); this allows a yalc-pushed module to contain a submodule’s contents (in its.yalc
folder), without those submodules becoming part of the npm-published contents as well (since that could cause bloat/redundancy/submodule-staleness).While
zalc
has been working fine for me, it’s not been tested enough to be “production ready” or anything; I mention it to spur ideas, and give an example of how yalc can be modified to include local copies of “dependency subtrees” rather than just a single dependency.I can give more detailed instructions on how to set zalc up for this purpose is needed; zalc’s entire source-code is only 41 lines long atm though, so that may be unnecessary: https://github.com/Venryx/zalc/blob/master/Source/Bin.ts
I just tried:
For anybody who might be stuck with this “nested dependencies” issue, this worked for me. (this solution is already mentioned way up here, but just in case)
For each dependency that has nested dependencies, add
.yalc
to list offiles
array in package json. likeand run
yalc publish --push
oryalc push
from this package. This will push the dependency package with ‘.yalc’ directory included in it, hence fixing this error.Sorry, could you explain how nested packages are supposed to work with yalc? Are they supported or not? And if they are, what are the steps to getti g nested packages working?
On Mon, 24 Dec 2018, 16:42 Alex <notifications@github.com wrote: