Skip to content

Commit

Permalink
limit outputted remote urls to one (#1574)
Browse files Browse the repository at this point in the history
* limit outputted remote urls to one

* pass a single remote ip instead of a list
  • Loading branch information
ducaale authored Nov 12, 2020
1 parent 1f50061 commit b8aba50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions snowpack/src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ export async function startDevServer(commandOptions: CommandOptions): Promise<Sn
}

// Announce server has started
const ips = Object.values(os.networkInterfaces())
const remoteIps = Object.values(os.networkInterfaces())
.reduce((every: os.NetworkInterfaceInfo[], i) => [...every, ...(i || [])], [])
.filter((i) => i.family === 'IPv4' && i.internal === false)
.map((i) => i.address);
Expand All @@ -1305,7 +1305,7 @@ export async function startDevServer(commandOptions: CommandOptions): Promise<Sn
protocol,
hostname,
port,
ips,
remoteIp: remoteIps[0],
startTimeMs: Math.round(performance.now() - serverStart),
});

Expand Down
8 changes: 4 additions & 4 deletions snowpack/src/commands/paint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ export async function getPort(defaultPort: number): Promise<number> {
}

export function getServerInfoMessage(
{startTimeMs, port, protocol, hostname, ips}: ServerInfo,
{startTimeMs, port, protocol, hostname, remoteIp}: ServerInfo,
isBuilding = false,
) {
let output = '';
const isServerStarted = startTimeMs > 0 && port > 0 && protocol;
if (isServerStarted) {
output += ` ${colors.bold(colors.cyan(`${protocol}//${hostname}:${port}`))}`;
for (const ip of ips) {
output += `${colors.cyan(` • `)}${colors.bold(colors.cyan(`${protocol}//${ip}:${port}`))}`;
if (remoteIp) {
output += `${colors.cyan(` • `)}${colors.bold(colors.cyan(`${protocol}//${remoteIp}:${port}`))}`;
}
output += '\n';
output += colors.dim(
Expand All @@ -104,7 +104,7 @@ interface ServerInfo {
hostname: string;
protocol: string;
startTimeMs: number;
ips: string[];
remoteIp?: string;
}

interface WorkerState {
Expand Down

1 comment on commit b8aba50

@vercel
Copy link

@vercel vercel bot commented on b8aba50 Nov 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.