add command set-figwheel-port

- used to set custom figwheel port in config.cljs
- fixes #151
This commit is contained in:
Artur Girenko 2017-11-12 13:03:24 +01:00
parent ce42e1bbd1
commit 5f6da94ae7
2 changed files with 14 additions and 1 deletions

View File

@ -901,6 +901,13 @@ autoRequire = (enabled, globally = false) ->
else
log "Auto-Require feature is disabled in use-figwheel command"
setFigwheelPort = (port, globally = false) ->
configFile = if globally then '.re-natal' else '.re-natal.local'
config = merge(readConfig(configFile, false), figwheelPort: port)
writeConfig(config, configFile)
log "Figwheel port is set to #{port}"
log "Please run: re-natal use-figwheel to take effect."
cli._name = 're-natal'
cli.version pkgJson.version
@ -989,6 +996,12 @@ cli.command 'enable-source-maps'
.action () ->
patchReactNativePackager()
cli.command 'set-figwheel-port <port>'
.description 'configures the port of figwheel server (port 3449 is default)'
.option '-g --global', 'use global .re-natal config instead of .re-natal.local'
.action (port, cmd) ->
setFigwheelPort(port, cmd.global)
cli.command 'enable-auto-require'
.description 'enables source scanning for automatic required module resolution in use-figwheel command.'
.option '-g --global', 'use global .re-natal config instead of .re-natal.local'

View File

@ -2,6 +2,6 @@
(def figwheel-urls {
{{#each platforms}}
:{{@key}} "ws://{{this.host}}:3449/figwheel-ws"
:{{@key}} "ws://{{this.host}}:{{#if ../figwheelPort}}{{../figwheelPort}}{{else}}3449{{/if}}/figwheel-ws"
{{/each}}
})