anvaka / npmgraph.an

2d visualization of npm

Home Page:https://npm.anvaka.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Analyze any package.json, not just npm packages

ccoenen opened this issue · comments

I'm helping out with a node.js project which is not itself a npm package. I would love to just toss this URL into the seach field and get its dependencies (or, of course, any other packe.json):

https://raw.githubusercontent.com/hackmdio/hackmd/master/package.json

I like this suggestion!

I made it work for the basic case, e.g. for this repository: http://npm.anvaka.com/#/view/2d/https%253A%252F%252Fraw.githubusercontent.com%252Fanvaka%252Fnpmgraph.an%252Fmaster%252Fpackage.json

For some reason it doesn't work for https://raw.githubusercontent.com/hackmdio/hackmd/master/package.json . I can look into this later, but the package that builds dependencies graph is here - https://github.com/anvaka/npmgraphbuilder if someone wants to dig deeper - please feel free to!

After a bit of fiddling with the graphbuilder, I believe the -ce suffix of 1.1.1-ce is to blame.

If I toss the exact version string into the demo, it works:

diff --git a/demo/index.js b/demo/index.js
index 91cabbf..20b519a 100644
--- a/demo/index.js
+++ b/demo/index.js
@@ -4,7 +4,7 @@ var graphBuilder = require('../')(httpClient);
 var pkgName = process.argv[2] || 'browserify';
 console.log('building dependencies graph for', pkgName);

-graphBuilder.createNpmDependenciesGraph(pkgName, graph).
+graphBuilder.createNpmDependenciesGraph(pkgName, graph, '1.1.1-ce').
   then(function (graph) {
     console.log('Done.');
     console.log('Nodes count: ', graph.getNodesCount());

the -ce is supposed to mean "community edition", but it's not a good idea to put it in that place as it is taken as "prerelease" by semver.

It works now, I believe the reason is that the project dropped the -ce suffix.

I'll close this. if this comes up again anywhere, someone can reopen this as a bug.