Skip to content

Commit

Permalink
fix(hosting): Fix #112. The BrowserRouter option should accept true|f…
Browse files Browse the repository at this point in the history
…alse in hosting config
  • Loading branch information
Adam Wardecki committed Feb 8, 2018
1 parent 8d8efab commit 2d2bde6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/cli-hosting.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const setup = async () => {
.description('Configure hosting parameters')
.option('-c, --cname <domain_name>', 'add CNAME to hosting')
.option('-d, --remove-cname <domain_name>', 'remove CNAME from hosting')
.option('-b, --browser_router', 'turn on BrowserRouter support')
.option('-b, --browser_router <true|false>', 'turn on/off the BrowserRouter support')
.action(async (...options) => {
session.isAuthenticated()
session.hasProject()
Expand Down
8 changes: 7 additions & 1 deletion packages/cli/src/commands/hosting-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ class HostingConfig {
this.hosting = null
}

static toggleBrowserRouter (command, responses) {
if (responses.browser_router) return responses.browser_router

return command === 'true'
}

async run ([hostingName, cmd]) {
this.cname = cmd.cname
this.fullPath = null
Expand All @@ -35,7 +41,7 @@ class HostingConfig {
const paramsToUpdate = {
cname: this.cname || responses.CNAME,
removeCNAME: cmd.removeCname,
browser_router: cmd.browser_router || responses.browser_router
browser_router: HostingConfig.toggleBrowserRouter(cmd.browser_router, responses)
}

await this.hosting.configure(paramsToUpdate)
Expand Down

0 comments on commit 2d2bde6

Please sign in to comment.