Skip to content

Commit ee33418

Browse files
authored
Allow setting port and dir
Per netlify#191
1 parent 0ebd840 commit ee33418

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/commands/dev/index.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,19 @@ class DevCommand extends Command {
184184
}
185185
process.env.NETLIFY_DEV = "true";
186186

187-
let settings = await serverSettings(Object.assign({}, config.dev, flags));
187+
let settings = await serverSettings(Object.assign({}, config.dev, {
188+
command: flags.command,
189+
port: flags.port,
190+
functions: flags.functions,
191+
publish: flags.dir,
192+
}));
188193

189194
if (!(settings && settings.command)) {
190195
this.log(
191196
`${NETLIFYDEVWARN} No dev server detected, using simple static server`
192197
);
193198
let dist =
199+
flags.dir ||
194200
(config.dev && config.dev.publish) ||
195201
(config.build && config.build.publish);
196202
if (!dist) {
@@ -211,7 +217,7 @@ class DevCommand extends Command {
211217
}
212218
settings = {
213219
noCmd: true,
214-
port: 8888,
220+
port: flags.port || 8888,
215221
proxyPort: 3999,
216222
dist
217223
};
@@ -296,7 +302,7 @@ DevCommand.strict = false;
296302
DevCommand.flags = {
297303
command: flags.string({ char: "c", description: "command to run" }),
298304
port: flags.integer({ char: "p", description: "port of netlify dev" }),
299-
dir: flags.integer({ char: "d", description: "dir with static files" }),
305+
dir: flags.string({ char: "d", description: "dir with static files" }),
300306
functions: flags.string({
301307
char: "f",
302308
description: "Specify a functions folder to serve"

0 commit comments

Comments
 (0)