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

Commit b650db7

Browse files
authored
Merge pull request #23 from netlify/small-ux-tweaks
Some small UX tweaks
2 parents 2620861 + 5fb2b51 commit b650db7

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/commands/dev/index.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ async function startProxy(settings, addonUrls) {
7777
function startDevServer(settings, log, error) {
7878
if (settings.noCmd) {
7979
const StaticServer = require('static-dev-server')
80+
if (!settings.dist) {
81+
log(
82+
'Unable to determine public folder for the dev server.\nSetup a netlify.toml file with a [dev] section to specify your dev server settings.'
83+
)
84+
process.exit(1)
85+
}
86+
8087
const server = new StaticServer({
8188
rootPath: settings.dist,
8289
name: 'netlify-dev',
@@ -115,7 +122,9 @@ class DevCommand extends Command {
115122
const {flags, args} = this.parse(DevCommand)
116123
const {api, site, config} = this.netlify
117124
const functionsDir =
118-
flags.functions || (config.build && config.build.functions)
125+
flags.functions ||
126+
(config.dev && config.dev.functions) ||
127+
(config.build && config.build.functions)
119128
const addonUrls = {}
120129
if (site.id && !flags.offline) {
121130
const accessToken = await this.authenticate()
@@ -145,11 +154,14 @@ class DevCommand extends Command {
145154
let settings = serverSettings(config.dev)
146155
if (!(settings && settings.cmd)) {
147156
this.log('No dev server detected, using simple static server')
157+
const dist =
158+
(config.dev && config.dev.publish) ||
159+
(config.build && config.build.publish)
148160
settings = {
149161
noCmd: true,
150162
port: 8888,
151163
proxyPort: 3999,
152-
dist: config.build && config.build.publish,
164+
dist,
153165
}
154166
}
155167
startDevServer(settings, this.log, this.error)

0 commit comments

Comments
 (0)