Skip to content

Commit

Permalink
Allow setting port and dir
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhuang authored May 30, 2019
1 parent 0ebd840 commit ee33418
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/commands/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,19 @@ class DevCommand extends Command {
}
process.env.NETLIFY_DEV = "true";

let settings = await serverSettings(Object.assign({}, config.dev, flags));
let settings = await serverSettings(Object.assign({}, config.dev, {
command: flags.command,
port: flags.port,
functions: flags.functions,
publish: flags.dir,
}));

if (!(settings && settings.command)) {
this.log(
`${NETLIFYDEVWARN} No dev server detected, using simple static server`
);
let dist =
flags.dir ||
(config.dev && config.dev.publish) ||
(config.build && config.build.publish);
if (!dist) {
Expand All @@ -211,7 +217,7 @@ class DevCommand extends Command {
}
settings = {
noCmd: true,
port: 8888,
port: flags.port || 8888,
proxyPort: 3999,
dist
};
Expand Down Expand Up @@ -296,7 +302,7 @@ DevCommand.strict = false;
DevCommand.flags = {
command: flags.string({ char: "c", description: "command to run" }),
port: flags.integer({ char: "p", description: "port of netlify dev" }),
dir: flags.integer({ char: "d", description: "dir with static files" }),
dir: flags.string({ char: "d", description: "dir with static files" }),
functions: flags.string({
char: "f",
description: "Specify a functions folder to serve"
Expand Down

0 comments on commit ee33418

Please sign in to comment.