Skip to content

Commit

Permalink
Adding options to for proxy server in new version of elm-serve
Browse files Browse the repository at this point in the history
  • Loading branch information
wking-io committed Oct 9, 2018
1 parent e10575b commit 4867502
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 10 deletions.
8 changes: 8 additions & 0 deletions bin/elm-live.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ program
.option('-o, --open [open]', 'Open in browser when server starts.', false)
.option('-r, --no-recover [no-recover]', `Stop server when ${chalk.cyan.underline('elm make')} runs into an issue.`)
.option('-u, --pushstate [pushstate]', `Forces the index.html file to always be served. Must be used when building with ${chalk.cyan.underline('Browser.application')}.`, false)
.option(
'-x, --proxyPrefix [prefix]',
'Proxy requests to paths starting with `prefix` to another server. Requires `--proxyHost` and should be a string like `/api`. Defaults to not proxying'
)
.option(
'-y, --proxyHost [proxyhost]',
'Proxy requests to another server running at `host`. Requires `--proxyHost` and should be a full URL, eg. `http://localhost:9000`. Defaults to not proxying'
)
.option('-b, --before-build [before-build]', `Run EXECUTABLE before every rebuild. This way you can easily use other tools like ${chalk.cyan.underline('elm-css')} or ${chalk.cyan.underline('browserify')} in your workflow.`)
.option('-a, --after-build [after-build]', `Just like ${chalk.cyan.underline('--before-build')}, but runs after ${chalk.cyan.underline('elm make')}.`)
.on('--help', () => {
Expand Down
50 changes: 42 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"chalk": "^1.1.1",
"chokidar": "1.6.0",
"commander": "2.17.1",
"cross-spawn": "^5.0.1",
"elm-serve": "0.1.3"
"cross-spawn": "5.0.1",
"elm-serve": "0.2.0"
},
"scripts": {
"develop": "ava --watch",
Expand Down
4 changes: 4 additions & 0 deletions source/elm-live.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ module.exports = (argv, options) => {
open: argv.open || false,
recover: argv.recover !== false,
pushstate: argv.pushstate || false,
proxyPrefix: argv.proxyPrefix || false,
proxyHost: argv.proxyHost || false,
elmMakeArgs: argv.args || []
},
(argv.beforeBuild ? { beforeBuild: argv.beforeBuild } : {}),
Expand Down Expand Up @@ -162,6 +164,8 @@ ${chalk.dim('elm-live:')}
open: args.open,
dir: args.dir,
pushstate: args.pushstate,
proxyPrefix: args.proxyPrefix,
proxyHost: args.proxyHost,
startPage: 'index.html'
})

Expand Down

0 comments on commit 4867502

Please sign in to comment.