UNPKG

468 BJavaScriptView Raw
1var url = require('url');
2var child = require('child_process');
3
4module.exports = function(topic) {
5 return {
6 topic: topic,
7 command: 'open',
8 description: 'open the local web process in a web browser',
9 help: `help text for ${topic}:open`,
10 run: open
11 }
12};
13
14function open(context) {
15 var host = url.parse(process.env.DOCKER_HOST).hostname;
16 var web = `http://${host}:3000`;
17 console.log(`opening ${web}...`);
18 child.execSync(`open "${web}"`);
19}