Skip to content

Commit

Permalink
add command set-figwheel-port
Browse files Browse the repository at this point in the history
- used to set custom figwheel port in config.cljs
- fixes #151
  • Loading branch information
drapanjanas committed Nov 12, 2017
1 parent ce42e1b commit 5f6da94
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions re-natal.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion resources/config.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
})

0 comments on commit 5f6da94

Please sign in to comment.