Giter Club home page Giter Club logo

node-dependencies-view's Issues

manage file not found errors

In some repositories, I deliberately exclude files containing some sensitive information (e.g. API keys stored in a params.json file).

node-dependencies-view then fails at generating the svg, producing the following error message:

{ Error: Cannot find module '../params.json'
    at Function.Module._resolveFilename (module.js:469:15)
    at resolveFileName (/tmp/node-dependencies-view/node_modules/resolve-from/index.js:17:39)
    at resolveFrom (/tmp/node-dependencies-view/node_modules/resolve-from/index.js:31:9)
    at module.exports (/tmp/node-dependencies-view/node_modules/resolve-from/index.js:34:41)
    at inspect (/tmp/node-dependencies-view/dependency-tree.js:32:22)
    at module.exports (/tmp/node-dependencies-view/dependency-tree.js:14:24)
    at download.then.then (/tmp/node-dependencies-view/graph.js:16:16) code: 'MODULE_NOT_FOUND' }
TypeError: Cannot read property 'split' of undefined
    at graph.then.dot (/tmp/node-dependencies-view/server.js:27:24)

Two possible solutions are:

  • skip the file not found (and possibly warn about incomplete results in the produced svg)
  • catch the error, and concatenate baseand req, instead on relying on function resolve.

This second solution worked well for me:

try {
	var resolved = resolve(path.dirname(file), req)
} 
catch(e) {
	var resolved = base + req
}
let rel = '.' + resolved.slice(base.length)

Would you consider a pull request for this?

Branch support

Awesome project!

Any chance you'd consider modifying the project so branches other than master could be specified? Or would you be open to accepting pull-requests that do that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.