File tree Expand file tree Collapse file tree 3 files changed +16
-11
lines changed
Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -175,9 +175,9 @@ madge('path/to/app.js').then((res) => {
175175});
176176```
177177
178- #### .dot()
178+ #### .dot([ circularOnly: boolean ] )
179179
180- > Returns a ` Promise ` resolved with a DOT representation of the module dependency graph.
180+ > Returns a ` Promise ` resolved with a DOT representation of the module dependency graph. Set ` circularOnly ` to only include circular dependencies.
181181
182182``` javascript
183183const madge = require (' madge' );
Original file line number Diff line number Diff line change @@ -248,6 +248,13 @@ function createOutputFromOptions(program, res) {
248248 } ) ;
249249 }
250250
251+ if ( program . dot ) {
252+ return res . dot ( program . circular ) . then ( ( output ) => {
253+ process . stdout . write ( output ) ;
254+ return res ;
255+ } ) ;
256+ }
257+
251258 if ( program . circular ) {
252259 const circular = res . circular ( ) ;
253260
@@ -261,11 +268,4 @@ function createOutputFromOptions(program, res) {
261268
262269 return res ;
263270 }
264-
265- if ( program . dot ) {
266- return res . dot ( ) . then ( ( output ) => {
267- process . stdout . write ( output ) ;
268- return res ;
269- } ) ;
270- }
271271}
Original file line number Diff line number Diff line change @@ -158,10 +158,15 @@ class Madge {
158158 /**
159159 * Return the module dependency graph as DOT output.
160160 * @api public
161+ * @param {Boolean } circularOnly
161162 * @return {Promise }
162163 */
163- dot ( ) {
164- return graph . dot ( this . obj ( ) , this . circular ( ) , this . config ) ;
164+ dot ( circularOnly ) {
165+ return graph . dot (
166+ circularOnly ? this . circularGraph ( ) : this . obj ( ) ,
167+ this . circular ( ) ,
168+ this . config
169+ ) ;
165170 }
166171
167172 /**
You can’t perform that action at this time.
0 commit comments