Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

Commit a84202c

Browse files
RaeesBhattiswyxio
authored andcommitted
Make ports for local server dynamic (#205)
* Make ports for local server dynamic * Check for port flag
1 parent 29a70d2 commit a84202c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/commands/dev/index.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,19 @@ class DevCommand extends Command {
212212
settings = {
213213
noCmd: true,
214214
port: 8888,
215-
proxyPort: 3999,
215+
proxyPort: await getPort({ port: 3999 }),
216216
dist
217217
};
218218
}
219219

220+
// Reset port if not manually specified, to make it dynamic
221+
if (!(config.dev && config.dev.port) && !flags.port) {
222+
settings = {
223+
port: await getPort({ port: settings.port }),
224+
...settings
225+
};
226+
}
227+
220228
startDevServer(settings, this.log);
221229

222230
// serve functions from zip-it-and-ship-it

0 commit comments

Comments
 (0)