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.

Ignore node_modules folders

See original GitHub issue

For the context: I want to use a combination of lerna and fractal, each fractal component being a npm package handled by lerna. This means that each component can have dependencies to other components or external libraries and can have a node_modules folder.

On the other hand, I don’t want those node_modules folders to appear in my style guide, that’s why I’d need fractal to ignore them.

Digging in the source, I found out that it can be done quite easily by changing src/core/fs.js (line 118) by:

    if (recursive && statCache.isDirectory() && Path.basename(filePath) != 'node_modules') {

That’s all it takes to ignore node_modules folders.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
yhuardcommented, May 1, 2017

@sbaechler thanks for your suggestion but the problem I’m trying to solve is a bit different than yours. My goal is to be able to ignore nested components.

Let’s say I have 2 components named component-a and component-b and the following folder structure:

| components
|-- component-a
|-- component-b

Now let’s say that component-b depends on component-a. In component-b’s package.json, I will have something like:

"dependencies": {
  "component-a": "1.0.0"
}

Since I use lerna to manage my monorepo, when I run lerna bootstrap I’ll get:

| components
|-- component-a
|-- component-b
|     |-- node_modules
|           |-- component-a

And fractal will display the nested component-a. This is what I want to avoid.

1reaction
mihkeleidastcommented, May 2, 2020

This has been implemented in #572

Read more comments on GitHub >

github_iconTop Results From Across the Web

node modules - Git - Ignore node_modules folder everywhere
Open sourcetree; click particular project; click settings; click Advanced; click Edit gitignore; Write "node_modules"; And Save.
Read more >
Exclude node_modules Folder from Git using .gitignore
The best way to exclude a folder from Git is to add a .gitignore file to the root of the project. This file...
Read more >
How to ignore the node_modules folder in Git? - Tim Mousk
To ignore the node_modules folder, you must create a .gitignore file. Then write the folder name to ignore it. ... Sometimes, however, a...
Read more >
Git ignore node modules - Simple Solution and Common ...
Git ignore node modules - Simple Solution and Common Gotchas ... It will match the node_modules directory anywhere in your git repository.
Read more >
gitignore node_modules - Linux Hint
The node_modules folder is a folder that contains all the packages installed and required by your JavaScript project. Although the node_modules folder is ......
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