Skip to content
Closed
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
14 changes: 12 additions & 2 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ function escapeArg(arg) {
return arg;
}

function buildCommandWithPort(command, port) {
if (!port) return command;

if (process.platform === 'win32') {
return `set PORT=${port} && ${command}`;
}
return `PORT=${port} ${command}`;
}

const serverCommand = [
`node`,
inspectorServerPath,
Expand All @@ -34,17 +43,18 @@ const serverCommand = [
.filter(Boolean)
.join(" ");

const clientCommand = `node ${inspectorClientPath}`;
const CLIENT_PORT = process.env.CLIENT_PORT ?? "";
const SERVER_PORT = process.env.SERVER_PORT ?? "";

const { result } = concurrently(
[
{
command: `PORT=${SERVER_PORT} ${serverCommand}`,
command: buildCommandWithPort(serverCommand, SERVER_PORT),
name: "server",
},
{
command: `PORT=${CLIENT_PORT} node ${inspectorClientPath}`,
command: buildCommandWithPort(clientCommand, CLIENT_PORT),
name: "client",
},
],
Expand Down