Closed harrisonzhu-db closed 3 months ago
Hi @harrisonzhu-db thanks for raising this issue. Does this also occur on the latest version of dependency-cruiser? 12.2 is already ~1.5 years old and I recall the baseDir
not working as expected in earlier versions.
Hi - thanks for the response. Was there a workaround to the baseDir
issue? I'm using 12.2 specifically since later versions are ESM only. Not sure if I can test w/ later versions.
Hi @harrisonzhu-db baseDir
used to not work at all. It was fixed as a drive-by in a PR for a new feature, but don't recall which PR or when it was made. Regardless - between the 44 releases between v12.2.x and the current version many a bug was fixed & many a feature was added. This is why I encourage anyone to upgrade when possible.
Seeing the code from your other issue it is likely 'converting' to ESM won't a large a hurdle, it looks like it's there already for 90%, although typescript might need a bit of convincing (a tsconfig.json with "target": "ES2022"
, "module": "NodeNext"
and "moduleResolution": "NodeNext"
seems to work in my other projects - YMMV).
If the issue persists in the latest version I'd love to see a minimal reproduction example so we're sure we're looking at the same thing and it's possible to debug (+ come up with a fix if necessary).
Sounds good - I'll see if converting to ESM is an option for me. However, just to be clear, when i say baseDir
it's not an argument I was passing in - it was just something dependency-cruiser
was outputting based on where i ran my project from.
@sverweij another hypothesis - I mentioned that these issues arise simply from running cruise(<path>)
from different directories on the same path. However, the directory where cruise
is malfunctioning itself is set up w/ yarn PnP, and running cruise
in fresh yarn projects (w/ a traditional node_modules
directory) in other locations work as intended - is there any chance that dependency-cruiser@12.12.2
is reading some config from the directory in which its script is located rather than the directory that it should target?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Summary
I'm migrating my package that uses
dependency-cruiser
from one location to another. Using the exact same code, mycruise
output gives the following in itssummary
old package location (works):
new package location (does not work):
everything is the same here except the
baseDir
andargs
. But resolvingbaseDir/args
resolves to the same absolute path, so I'm not sure why there would be a difference in outputs, since I would hope that the operation ofcruise
is agnostic of where the script is located.Context
Moving from a traditional yarn setup to a yarn pnp directory.
Environment