dyatko / arkit

JavaScript architecture diagrams and dependency graphs
https://arkit.pro
MIT License
950 stars 42 forks source link

Arkit crash during running on medium size project #28

Open davojta opened 5 years ago

davojta commented 5 years ago

Bug description

To Reproduce

  1. Operating system Ubuntu 16/04
  2. Arkit version and CLI arguments 1.3.13
╰─$ node --version
v10.15.2
  1. Arkit config, if any was used
    
    {
    "components": [
    {
      "type": "Dependency",
      "patterns": [
        "node_modules/*"
      ]
    },
    {
      "type": "Component",
      "patterns": [
        "**/*.ts",
        "**/*.js",
        "**/*.jsx",
        "**/*.tsx"
      ]
    }
    ],
    "excludePatterns": [
    "test",
    "tests",
    "dist",
    "coverage",
    "**/*.test.*",
    "**/*.spec.*",
    "**/*.min.*"
    ],
    "output": [
    {
      "path": [
        "svg"
      ],
      "groups": [
        {
          "first": true,
          "components": [
            "Component"
          ]
        },
        {
          "type": "Dependencies",
          "components": [
            "Dependency"
          ]
        }
      ]
    }
    ]
    }

4. Source code example, if it's possible
I run on my project, so cant share it whole source base
davojta commented 5 years ago

here is logs - https://gist.github.com/davojta/d7dba19d5f8f2d5be7932043fff07c84

dyatko commented 5 years ago

@davojta Thanks for the bug report! I've published some potential fixes in v1.3.14, please try again with logging.

karevn commented 5 years ago

I've got a very similar issue with 1.3.14

https://gist.github.com/karevn/c0cda153fb233c74b38cd847fb4399e8

dyatko commented 5 years ago

@karevn actually, it's a bit different and I suspect it's related to Node version. Could you please update arkit to 1.3.16 and try again?

karevn commented 5 years ago

I've upgraded to 1.3.17, exactly the same error. Node.js version 8.11.2, and upgrading it is not an option in the meantime.

karevn commented 5 years ago

Still have the same issue on 1.5.3


TypeError: componentsByName[component.name].push is not a function
    at Generator.resolveConflictingComponentNames (/Users/v8cult/src/corp-client/node_modules/arkit/dist/generator.js:124:46)
    at Generator.generate (/Users/v8cult/src/corp-client/node_modules/arkit/dist/generator.js:13:59)
    at Promise.all.outputs.reduce (/Users/v8cult/src/corp-client/node_modules/arkit/dist/arkit.js:46:34)
    at Array.reduce (<anonymous>)
    at exports.getOutputs (/Users/v8cult/src/corp-client/node_modules/arkit/dist/arkit.js:45:32)
    at Object.<anonymous> (/Users/v8cult/src/corp-client/node_modules/arkit/index.js:23:3)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
ghost commented 4 years ago

@karevn have you been able to resolve the issue? I have the same problem with both node10 and node13, btw I run on macOS

woodgear commented 3 years ago

same issue componentsByName[component.name].push is not a function,what should I do?

busilina commented 3 years ago

same here

tevaum commented 2 years ago

Hi all. I was having this issue too and I did some investigation. The thing is there are some libraries that use some reserved JS properties as the filename. In my case, the filenames causing the error were constructor.js, toString.js and valueOf.js, which were converted to constructor, toString and valueOf.

I just created a PR (#710) to fix this issue.

cc: @dyatko

lynoure commented 4 months ago

In my case today, the problematic files were from lodash. I could work around it by excluding those directories too, but I only found the culprit after debugging. I imagine many people are using Arkit to get a better understanding of a legacy code base, so it might make things much much easier to have more robust handling of the names.