Skip to content

Ignore node_modules #54

@mleonhard-notion

Description

@mleonhard-notion

HI @glato,
Thanks for making emerge. I'm trying to use it on our large TypeScript codebase (>10k files). I need to exclude 150k third-party imported files which are stored in node_modules directories.

When node_modules files are included, the graph structure is dominated by them. For example, in this screenshot, the blue constellation in the center is a file that imports from the @smithy/types library and the library files around it. The orange in the lower-left is the AWS client library. The halo around the graph are unused files from third-party libraries.

image

I tried using the ignore_dependencies_containing option in the config file, but it doesn't work for node_modules:

---
project_name: ts
loglevel: info
analyses:
  - analysis_name: ts
    source_directory: /Users/user/src/
    only_permit_languages:
      - typescript
    only_permit_file_extensions:
      - .ts
      - .tsx
    ignore_dependencies_containing:
      - node_modules
    file_scan:
      - number_of_methods
      - source_lines_of_code
      - dependency_graph
      - fan_in_out
      - louvain_modularity
      - tfidf
    export:
      - directory: /Users/user/emerge-export
      - graphml
      - json
      - tabular_file
      - tabular_console_overall
      - d3

Ideally, the tool would have an ignore_node_modules boolean option which defaults to true. Another option is to have an exclude_file_patterns option which we can set to **/node_modules/**.

Sincerely, Michael

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions