From 2d2bde6574d47a5a6c43a73e7c72fd88239ce956 Mon Sep 17 00:00:00 2001 From: Adam Wardecki Date: Thu, 8 Feb 2018 13:44:38 +0100 Subject: [PATCH] fix(hosting): Fix #112. The BrowserRouter option should accept true|false in hosting config --- packages/cli/src/cli-hosting.js | 2 +- packages/cli/src/commands/hosting-config.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/cli-hosting.js b/packages/cli/src/cli-hosting.js index d4ffb146..4d37a909 100755 --- a/packages/cli/src/cli-hosting.js +++ b/packages/cli/src/cli-hosting.js @@ -76,7 +76,7 @@ const setup = async () => { .description('Configure hosting parameters') .option('-c, --cname ', 'add CNAME to hosting') .option('-d, --remove-cname ', 'remove CNAME from hosting') - .option('-b, --browser_router', 'turn on BrowserRouter support') + .option('-b, --browser_router ', 'turn on/off the BrowserRouter support') .action(async (...options) => { session.isAuthenticated() session.hasProject() diff --git a/packages/cli/src/commands/hosting-config.js b/packages/cli/src/commands/hosting-config.js index 286b61dc..7dc7cbb4 100644 --- a/packages/cli/src/commands/hosting-config.js +++ b/packages/cli/src/commands/hosting-config.js @@ -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 @@ -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)