Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/commands/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async function startProxy(settings, addonUrls) {
});

server.listen(port);
return `http://localhost:${port}`;
return { url: `http://localhost:${port}`, port };
}

function startDevServer(settings, log) {
Expand Down Expand Up @@ -217,8 +217,6 @@ class DevCommand extends Command {
};
}

let url;

startDevServer(settings, this.log);

// serve functions from zip-it-and-ship-it
Expand All @@ -243,18 +241,18 @@ class DevCommand extends Command {
settings.functionsPort = functionsPort;
}

const proxyUrl = await startProxy(settings, addonUrls);
let { url, port } = await startProxy(settings, addonUrls);
if (!url) {
url = proxyUrl;
Copy link
Contributor

Choose a reason for hiding this comment

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

this conditional is not necessary anymore, is it?

}

if (flags.live) {
await waitPort({ port: settings.proxyPort });
await waitPort({ port });
const liveSession = await createTunnel(site.id, accessToken, this.log);
url = liveSession.session_url;
process.env.BASE_URL = url;

await connectTunnel(liveSession, accessToken, settings.port, this.log);
await connectTunnel(liveSession, accessToken, port, this.log);
}

// Todo hoist this telemetry `command` to CLI hook
Expand Down