Add possibility to specify port when running dep graph (#3938)
* feat(misc): add possibility to specify port when running dep graph * feat(docs): documentation was updated with the exposed port Co-authored-by: adrian.etter <adrian.etter@dswiss.com>
This commit is contained in:
parent
da4fe07c47
commit
992013ca0a
@ -102,6 +102,10 @@ Default: `false`
|
|||||||
|
|
||||||
Isolate projects which previously failed
|
Isolate projects which previously failed
|
||||||
|
|
||||||
|
### port
|
||||||
|
|
||||||
|
Bind the dep graph server to a specific port.
|
||||||
|
|
||||||
### runner
|
### runner
|
||||||
|
|
||||||
This is the name of the tasks runner configured in nx.json
|
This is the name of the tasks runner configured in nx.json
|
||||||
|
|||||||
@ -80,6 +80,10 @@ Show help
|
|||||||
|
|
||||||
Bind the dep graph server to a specific ip address.
|
Bind the dep graph server to a specific ip address.
|
||||||
|
|
||||||
|
### port
|
||||||
|
|
||||||
|
Bind the dep graph server to a specific port.
|
||||||
|
|
||||||
### version
|
### version
|
||||||
|
|
||||||
Show version number
|
Show version number
|
||||||
|
|||||||
@ -102,6 +102,10 @@ Default: `false`
|
|||||||
|
|
||||||
Isolate projects which previously failed
|
Isolate projects which previously failed
|
||||||
|
|
||||||
|
### port
|
||||||
|
|
||||||
|
Bind the dep graph server to a specific port.
|
||||||
|
|
||||||
### runner
|
### runner
|
||||||
|
|
||||||
This is the name of the tasks runner configured in nx.json
|
This is the name of the tasks runner configured in nx.json
|
||||||
|
|||||||
@ -80,6 +80,10 @@ Show help
|
|||||||
|
|
||||||
Bind the dep graph server to a specific ip address.
|
Bind the dep graph server to a specific ip address.
|
||||||
|
|
||||||
|
### port
|
||||||
|
|
||||||
|
Bind the dep graph server to a specific port.
|
||||||
|
|
||||||
### version
|
### version
|
||||||
|
|
||||||
Show version number
|
Show version number
|
||||||
|
|||||||
@ -102,6 +102,10 @@ Default: `false`
|
|||||||
|
|
||||||
Isolate projects which previously failed
|
Isolate projects which previously failed
|
||||||
|
|
||||||
|
### port
|
||||||
|
|
||||||
|
Bind the dep graph server to a specific port.
|
||||||
|
|
||||||
### runner
|
### runner
|
||||||
|
|
||||||
This is the name of the tasks runner configured in nx.json
|
This is the name of the tasks runner configured in nx.json
|
||||||
|
|||||||
@ -80,6 +80,10 @@ Show help
|
|||||||
|
|
||||||
Bind the dep graph server to a specific ip address.
|
Bind the dep graph server to a specific ip address.
|
||||||
|
|
||||||
|
### port
|
||||||
|
|
||||||
|
Bind the dep graph server to a specific port.
|
||||||
|
|
||||||
### version
|
### version
|
||||||
|
|
||||||
Show version number
|
Show version number
|
||||||
|
|||||||
@ -143,6 +143,7 @@ export function generateGraph(
|
|||||||
args: {
|
args: {
|
||||||
file?: string;
|
file?: string;
|
||||||
host?: string;
|
host?: string;
|
||||||
|
port?: number;
|
||||||
focus?: string;
|
focus?: string;
|
||||||
exclude?: string[];
|
exclude?: string[];
|
||||||
groupByFolder?: boolean;
|
groupByFolder?: boolean;
|
||||||
@ -265,11 +266,11 @@ export function generateGraph(
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
startServer(html, args.host || '127.0.0.1');
|
startServer(html, args.host || '127.0.0.1', args.port || 4211);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function startServer(html: string, host: string) {
|
function startServer(html: string, host: string, port = 4211) {
|
||||||
const app = http.createServer((req, res) => {
|
const app = http.createServer((req, res) => {
|
||||||
// parse URL
|
// parse URL
|
||||||
const parsedUrl = url.parse(req.url);
|
const parsedUrl = url.parse(req.url);
|
||||||
@ -316,13 +317,13 @@ function startServer(html: string, host: string) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.listen(4211, host);
|
app.listen(port, host);
|
||||||
|
|
||||||
output.note({
|
output.note({
|
||||||
title: `Dep graph started at http://${host}:4211`,
|
title: `Dep graph started at http://${host}:${port}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
opn(`http://${host}:4211`, {
|
opn(`http://${host}:${port}`, {
|
||||||
wait: false,
|
wait: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -361,6 +361,10 @@ function withDepGraphOptions(yargs: yargs.Argv): yargs.Argv {
|
|||||||
.option('host', {
|
.option('host', {
|
||||||
describe: 'Bind the dep graph server to a specific ip address.',
|
describe: 'Bind the dep graph server to a specific ip address.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
})
|
||||||
|
.option('port', {
|
||||||
|
describe: 'Bind the dep graph server to a specific port.',
|
||||||
|
type: 'number',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user