diff --git a/docs/angular/api-workspace/npmscripts/affected-dep-graph.md b/docs/angular/api-workspace/npmscripts/affected-dep-graph.md index 9cc3432e42..1b284ae158 100644 --- a/docs/angular/api-workspace/npmscripts/affected-dep-graph.md +++ b/docs/angular/api-workspace/npmscripts/affected-dep-graph.md @@ -76,6 +76,10 @@ Latest commit of the current branch (usually HEAD) Show help +### host + +Bind the dep graph server to a specific ip address. + ### only-failed Default: `false` diff --git a/docs/angular/api-workspace/npmscripts/dep-graph.md b/docs/angular/api-workspace/npmscripts/dep-graph.md index 83cbf713ca..328b934007 100644 --- a/docs/angular/api-workspace/npmscripts/dep-graph.md +++ b/docs/angular/api-workspace/npmscripts/dep-graph.md @@ -54,6 +54,10 @@ Use to limit the dependency graph to only show specific projects, list of projec Show help +### host + +Bind the dep graph server to a specific ip address. + ### version Show version number diff --git a/docs/react/api-workspace/npmscripts/affected-dep-graph.md b/docs/react/api-workspace/npmscripts/affected-dep-graph.md index 9cc3432e42..1b284ae158 100644 --- a/docs/react/api-workspace/npmscripts/affected-dep-graph.md +++ b/docs/react/api-workspace/npmscripts/affected-dep-graph.md @@ -76,6 +76,10 @@ Latest commit of the current branch (usually HEAD) Show help +### host + +Bind the dep graph server to a specific ip address. + ### only-failed Default: `false` diff --git a/docs/react/api-workspace/npmscripts/dep-graph.md b/docs/react/api-workspace/npmscripts/dep-graph.md index 83cbf713ca..328b934007 100644 --- a/docs/react/api-workspace/npmscripts/dep-graph.md +++ b/docs/react/api-workspace/npmscripts/dep-graph.md @@ -54,6 +54,10 @@ Use to limit the dependency graph to only show specific projects, list of projec Show help +### host + +Bind the dep graph server to a specific ip address. + ### version Show version number diff --git a/docs/web/api-workspace/npmscripts/affected-dep-graph.md b/docs/web/api-workspace/npmscripts/affected-dep-graph.md index 9cc3432e42..1b284ae158 100644 --- a/docs/web/api-workspace/npmscripts/affected-dep-graph.md +++ b/docs/web/api-workspace/npmscripts/affected-dep-graph.md @@ -76,6 +76,10 @@ Latest commit of the current branch (usually HEAD) Show help +### host + +Bind the dep graph server to a specific ip address. + ### only-failed Default: `false` diff --git a/docs/web/api-workspace/npmscripts/dep-graph.md b/docs/web/api-workspace/npmscripts/dep-graph.md index 83cbf713ca..328b934007 100644 --- a/docs/web/api-workspace/npmscripts/dep-graph.md +++ b/docs/web/api-workspace/npmscripts/dep-graph.md @@ -54,6 +54,10 @@ Use to limit the dependency graph to only show specific projects, list of projec Show help +### host + +Bind the dep graph server to a specific ip address. + ### version Show version number diff --git a/packages/workspace/src/command-line/dep-graph.ts b/packages/workspace/src/command-line/dep-graph.ts index 35b94a6835..3b131eb94b 100644 --- a/packages/workspace/src/command-line/dep-graph.ts +++ b/packages/workspace/src/command-line/dep-graph.ts @@ -30,7 +30,7 @@ const mimeType = { }; export function generateGraph( - args: { file?: string; filter?: string[]; exclude?: string[] }, + args: { file?: string; filter?: string[]; exclude?: string[]; host?: string }, affectedProjects: string[] ): void { const graph = onlyWorkspaceProjects(createProjectGraph()); @@ -55,14 +55,20 @@ export function generateGraph( ) ); } else { - startServer(renderProjects, graph, affectedProjects); + startServer( + renderProjects, + graph, + affectedProjects, + args.host || '127.0.0.1' + ); } } function startServer( projects: ProjectGraphNode[], graph: ProjectGraph, - affected: string[] + affected: string[], + host: string ) { const f = readFileSync( join(__dirname, '../core/dep-graph/dep-graph.html') @@ -124,12 +130,13 @@ function startServer( }); }); - app.listen(4211, '127.0.0.1'); + app.listen(4211, host); + output.note({ - title: 'Dep graph started at http://localhost:4211' + title: `Dep graph started at http://${host}:4211` }); - opn('http://localhost:4211', { + opn(`http://${host}:4211`, { wait: false }); } diff --git a/packages/workspace/src/command-line/nx-commands.ts b/packages/workspace/src/command-line/nx-commands.ts index 58a402cd5c..9dd5c9a972 100644 --- a/packages/workspace/src/command-line/nx-commands.ts +++ b/packages/workspace/src/command-line/nx-commands.ts @@ -332,6 +332,10 @@ function withDepGraphOptions(yargs: yargs.Argv): yargs.Argv { 'List of projects delimited by commas to exclude from the dependency graph.', type: 'array', coerce: parseCSV + }) + .option('host', { + describe: 'Bind the dep graph server to a specific ip address.', + type: 'string' }); }