-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Madge Builder to graph commonJS/AMD dependencies. #4
base: master
Are you sure you want to change the base?
Changes from all commits
b197723
445a31c
cd5d666
d90f48f
3278040
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.idea | ||
*.iml | ||
*.xml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"use strict"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move that to another PR. Not sure I'll merge that one, by the way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. build.js is a crossplatform way of publishing the content (it also includes minification). If you don't wish to add the package.json i'll submit it to npm myself with a reference to your repository. |
||
|
||
var UglifyJS = require('uglify-js'), | ||
fs = require('fs'), | ||
pkgInfo = require('./package.json'), | ||
sourceFile = __dirname + '/lib/' + pkgInfo.main.replace('dist/', ''), | ||
targetFile = __dirname + '/' + pkgInfo.main, | ||
targetMinFile = __dirname + '/' + pkgInfo.main.replace(/.js$/, '') + '.min.js', | ||
source = fs.readFileSync(sourceFile); | ||
|
||
if (!fs.existsSync('./dist')) { | ||
fs.mkdirSync('./dist'); | ||
} | ||
|
||
fs.writeFileSync(targetFile, source); | ||
fs.writeFileSync(targetMinFile, UglifyJS.minify(targetFile).code); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"benchmarks/middleware":["http","index"],"index":["lib/express"],"lib/application":["debug","escape-html","http","lib/middleware/init","lib/middleware/query","lib/router/index","lib/utils","lib/view","methods","utils-merge"],"lib/express":["events","lib/application","lib/middleware/query","lib/request","lib/response","lib/router/index","lib/router/route","serve-static","utils-merge"],"lib/middleware/init":[],"lib/middleware/query":["parseurl","qs"],"lib/request":["accepts","fresh","http","parseurl","proxy-addr","range-parser","type-is"],"lib/response":["cookie","cookie-signature","escape-html","http","lib/utils","path","send","utils-merge"],"lib/router/index":["debug","lib/router/layer","lib/router/route","methods","parseurl"],"lib/router/layer":["debug","path-to-regexp"],"lib/router/route":["debug","lib/utils","methods"],"lib/utils":["buffer-crc32","path","proxy-addr","send","util"],"lib/view":["fs","lib/utils","path"],"support/app":["index"]} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
(function(root, factory) { | ||
if(typeof define === 'function' && define.amd) { | ||
define([], factory); | ||
} else if(typeof exports === 'object') { | ||
module.exports = factory(); | ||
} else { | ||
root.buildMatrixFromMadge = factory(); | ||
} | ||
}(this, function() { | ||
|
||
"use strict"; | ||
|
||
var buildMatrixFromMadge = function(madgeTree) { | ||
|
||
var packageNames = [], matrix = [], i = 0, mapModIdx = {}; | ||
|
||
//populate packagenames | ||
for(var module in madgeTree) { | ||
packageNames.push(module); | ||
mapModIdx[module] = i; | ||
i++; | ||
} | ||
|
||
for(var module in madgeTree) { | ||
var deps = madgeTree[module], | ||
matrixRow = Array.apply(null, new Array(packageNames.length)).map(Number.prototype.valueOf, 0); | ||
|
||
deps.forEach(function(mod) { | ||
matrixRow[mapModIdx[mod]] = 1; | ||
}); | ||
|
||
matrix.push(matrixRow); | ||
} | ||
|
||
return { | ||
packageNames: packageNames, | ||
matrix: matrix | ||
} | ||
}; | ||
|
||
return buildMatrixFromMadge; | ||
|
||
})); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "dependency-wheel", | ||
"version": "0.1.0", | ||
"description": "A package dependency visualization using d3.js. Currently supports Composer for PHP and Madge for AMD/CommonJS.", | ||
"main": "dist/d3.dependencyWheel.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/fzaninotto/DependencyWheel.git" | ||
}, | ||
"scripts": { | ||
"prepublish": "node build.js" | ||
}, | ||
"keywords": [ | ||
"D3", | ||
"Graph", | ||
"Package", | ||
"Dependency", | ||
"Composer", | ||
"PHP" | ||
], | ||
"author": "François Zaninotto", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/fzaninotto/DependencyWheel/issues" | ||
}, | ||
"homepage": "https://github.com/fzaninotto/DependencyWheel", | ||
"devDependencies": { | ||
"uglify-js": "^2.4.13" | ||
}, | ||
"npmName": "dependency-wheel", | ||
"npmFileMap": [ | ||
{ | ||
"basePath": "/dist/", | ||
"files": [ | ||
"*.js" | ||
] | ||
} | ||
], | ||
"dependencies": { | ||
"d3": "^3.4.8" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var madge = require('madge'); | ||
|
||
var dependencies = madge('./express-master/', {exclude: '^examples*|^test*'}).tree; | ||
|
||
console.log(JSON.stringify(dependencies)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't commit that file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I created this file, is that during npm's publishing process it misses the dist folder due to it being in my .gitignore file. https://www.npmjs.org/doc/developers.html
You could create an empty .gitignore file so that it doesn't use by default what is in .gitignore.