feat(core): adds host binding option to dep-graph command
This commit is contained in:
parent
413dce9e6f
commit
4d8b38b7ce
@ -76,6 +76,10 @@ Latest commit of the current branch (usually HEAD)
|
|||||||
|
|
||||||
Show help
|
Show help
|
||||||
|
|
||||||
|
### host
|
||||||
|
|
||||||
|
Bind the dep graph server to a specific ip address.
|
||||||
|
|
||||||
### only-failed
|
### only-failed
|
||||||
|
|
||||||
Default: `false`
|
Default: `false`
|
||||||
|
|||||||
@ -54,6 +54,10 @@ Use to limit the dependency graph to only show specific projects, list of projec
|
|||||||
|
|
||||||
Show help
|
Show help
|
||||||
|
|
||||||
|
### host
|
||||||
|
|
||||||
|
Bind the dep graph server to a specific ip address.
|
||||||
|
|
||||||
### version
|
### version
|
||||||
|
|
||||||
Show version number
|
Show version number
|
||||||
|
|||||||
@ -76,6 +76,10 @@ Latest commit of the current branch (usually HEAD)
|
|||||||
|
|
||||||
Show help
|
Show help
|
||||||
|
|
||||||
|
### host
|
||||||
|
|
||||||
|
Bind the dep graph server to a specific ip address.
|
||||||
|
|
||||||
### only-failed
|
### only-failed
|
||||||
|
|
||||||
Default: `false`
|
Default: `false`
|
||||||
|
|||||||
@ -54,6 +54,10 @@ Use to limit the dependency graph to only show specific projects, list of projec
|
|||||||
|
|
||||||
Show help
|
Show help
|
||||||
|
|
||||||
|
### host
|
||||||
|
|
||||||
|
Bind the dep graph server to a specific ip address.
|
||||||
|
|
||||||
### version
|
### version
|
||||||
|
|
||||||
Show version number
|
Show version number
|
||||||
|
|||||||
@ -76,6 +76,10 @@ Latest commit of the current branch (usually HEAD)
|
|||||||
|
|
||||||
Show help
|
Show help
|
||||||
|
|
||||||
|
### host
|
||||||
|
|
||||||
|
Bind the dep graph server to a specific ip address.
|
||||||
|
|
||||||
### only-failed
|
### only-failed
|
||||||
|
|
||||||
Default: `false`
|
Default: `false`
|
||||||
|
|||||||
@ -54,6 +54,10 @@ Use to limit the dependency graph to only show specific projects, list of projec
|
|||||||
|
|
||||||
Show help
|
Show help
|
||||||
|
|
||||||
|
### host
|
||||||
|
|
||||||
|
Bind the dep graph server to a specific ip address.
|
||||||
|
|
||||||
### version
|
### version
|
||||||
|
|
||||||
Show version number
|
Show version number
|
||||||
|
|||||||
@ -30,7 +30,7 @@ const mimeType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function generateGraph(
|
export function generateGraph(
|
||||||
args: { file?: string; filter?: string[]; exclude?: string[] },
|
args: { file?: string; filter?: string[]; exclude?: string[]; host?: string },
|
||||||
affectedProjects: string[]
|
affectedProjects: string[]
|
||||||
): void {
|
): void {
|
||||||
const graph = onlyWorkspaceProjects(createProjectGraph());
|
const graph = onlyWorkspaceProjects(createProjectGraph());
|
||||||
@ -55,14 +55,20 @@ export function generateGraph(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
startServer(renderProjects, graph, affectedProjects);
|
startServer(
|
||||||
|
renderProjects,
|
||||||
|
graph,
|
||||||
|
affectedProjects,
|
||||||
|
args.host || '127.0.0.1'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function startServer(
|
function startServer(
|
||||||
projects: ProjectGraphNode[],
|
projects: ProjectGraphNode[],
|
||||||
graph: ProjectGraph,
|
graph: ProjectGraph,
|
||||||
affected: string[]
|
affected: string[],
|
||||||
|
host: string
|
||||||
) {
|
) {
|
||||||
const f = readFileSync(
|
const f = readFileSync(
|
||||||
join(__dirname, '../core/dep-graph/dep-graph.html')
|
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({
|
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
|
wait: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -332,6 +332,10 @@ function withDepGraphOptions(yargs: yargs.Argv): yargs.Argv {
|
|||||||
'List of projects delimited by commas to exclude from the dependency graph.',
|
'List of projects delimited by commas to exclude from the dependency graph.',
|
||||||
type: 'array',
|
type: 'array',
|
||||||
coerce: parseCSV
|
coerce: parseCSV
|
||||||
|
})
|
||||||
|
.option('host', {
|
||||||
|
describe: 'Bind the dep graph server to a specific ip address.',
|
||||||
|
type: 'string'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user