question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

doNotFollow in API works unexpectedly

See original GitHub issue

Maybe this isn’t actually a bug and I just misunderstand the purpose of this option? If that’s the case feel free to correct my expectations 🙂

Expected Behavior

Including doNotFollow: 'node_modules' in the API options adds the list of dependencies my modules have on npm packages but doesn’t include those npm packages in dependency traversal.

Current Behavior

Including doNotFollow: 'node_modules' adds the list of npm package dependencies but also traverses all of node_modules.

Steps to Reproduce

repro repo

  1. Compare cruise(['./'], {doNotFollow: 'node_modules'}).output with cruise(['./']).output: there appears to be no difference.

Context

Wishing to get a list of dependencies (including npm package dependencies) but without traversing node_modules because that folder gets huge and I don’t care about the dependencies in there 🙂

Your Environment

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
sverweijcommented, Apr 8, 2020

I, of course, would vote for the change the behaviour to be more intuitive option but I don’t know > anything about how this might affect current users.

Second that - it should’ve worked that way from the outset (so thanks for realising this, raising it as an issue and being tenacious!). I doubt it is going to affect a lot of current users - or even whether it would classify as a breaking change. But even if it is, dependency-cruiser will get a major-bump - which will have to happen soon anyway because node 8 support is becoming untenable and needs to be dropped.

1reaction
sverweijcommented, Apr 7, 2020

Hi @electrovir - this is similar to the mono-repo I’ve worked with over the last years. We’ve been using something like packages/*/{src,lib} as a pattern because that’s where the sources typically resided. For also including all cases maybe-not-named-src some glob magic will be required indeed.

As a first try I’ve used the pattern "packages/*/!(node_modules)" - and that works as expected, in the sense that scans everything in packages/*/, except node_modules. You might want to include some extra inclusion patterns there for good measure - dist (or wherever generated javascript goes), coverage might be good candidates, but maybe also config files…

const lResult = cruise(["packages/*/!(node_modules|dist|coverage)"], {
  doNotFollow: "node_modules",
  outputType: "text", // or whatever reporter you'd want to use
}).output;

under the hood dependency-cruiser uses glob, for argument matching. You can exercise that with minimatch for quick feedback cycles on what patterns yield what result

=> Just interested: what’s the reason to use the API instead of the cli?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Evolving "nofollow" – new ways to identify the nature of links
Today, we're announcing two new link attributes that provide webmasters with additional ways to identify to Google Search the nature of particular links....
Read more >
Nofollow link and rel=nofollow explained - ContentKing
Despite "sponsored" and "ugc", the nofollow link attribute remains an important factor to consider when creating and building links!
Read more >
The Hidden Power of Nofollow Links - Moz
Here's why nofollow links are more powerful than you might think. ... post I read is really relevant to this blog post I'm...
Read more >
[0.63.1][Android] Dimensions API stops working randomly after ...
stops working/firing events randomly after a while. I can't figure out exactly what triggers the issue, but after the event listener stops ...
Read more >
Error-Oops, you've found a dead link. - JIRA
Solved: I am trying to hit the API ... Atlassian Jira <a class="seo-link" rel="nofollow" ... Can you work with /rest/api/2/issue ?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found