From b1977237e0a47808637b36d1415a943026f88f84 Mon Sep 17 00:00:00 2001 From: Drew Foehn Date: Wed, 21 May 2014 18:34:48 -0400 Subject: [PATCH 1/4] Added Madge Builder to graph commonJS/AMD dependencies. Added npm package.json for distribution with npm. Created a build file to minify clientlib. Renamed js to lib to match npm BP. Updated index to show Madge graph. --- .gitignore | 1 + .npmignore | 3 +++ build.js | 16 ++++++++++++ data/madge-express.json | 1 + index.html | 21 ++++++++++++--- js/d3.min.js | 5 ---- {js => lib}/composerBuilder.js | 29 ++++++++++++++++++--- {js => lib}/d3.dependencyWheel.js | 19 +++++++++++++- lib/madgeBuilder.js | 43 +++++++++++++++++++++++++++++++ package.json | 42 ++++++++++++++++++++++++++++++ 10 files changed, 167 insertions(+), 13 deletions(-) create mode 100644 .gitignore create mode 100644 .npmignore create mode 100644 build.js create mode 100644 data/madge-express.json delete mode 100644 js/d3.min.js rename {js => lib}/composerBuilder.js (78%) rename {js => lib}/d3.dependencyWheel.js (91%) create mode 100644 lib/madgeBuilder.js create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1521c8b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dist diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..5d69da3 --- /dev/null +++ b/.npmignore @@ -0,0 +1,3 @@ +.idea +*.iml +*.xml diff --git a/build.js b/build.js new file mode 100644 index 0000000..9165250 --- /dev/null +++ b/build.js @@ -0,0 +1,16 @@ +"use strict"; + +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); \ No newline at end of file diff --git a/data/madge-express.json b/data/madge-express.json new file mode 100644 index 0000000..a887306 --- /dev/null +++ b/data/madge-express.json @@ -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"]} diff --git a/index.html b/index.html index 4bf1bf5..e376586 100644 --- a/index.html +++ b/index.html @@ -21,7 +21,7 @@ margin: 1em 0; } -#chart_placeholder { +#chart_placeholder, #express_chart { text-align: center; margin-bottom: 20px; } @@ -101,6 +101,11 @@

Usage

Sharing your DependencyWheels

The best way to share your DependencyWheels is to use GitHub Pages, just like this very page. So just fork the fzaninotto/DependencyWheel repository, add your own JSON data under the data/ directory, commit the code, and push to the gh-pages branch. GitHub will publish the result for you.

+ +

Example Using Madge Tree Output from express.js

+ +
+

Licence

All this work is open-source, published by François Zaninotto under the MIT license. Sponsored by marmelab.

@@ -115,9 +120,10 @@

Licence

Fork me on GitHub - - - + + + +