From 327962b4b30f5a5315ef9630f418164b3cca3ddb Mon Sep 17 00:00:00 2001 From: Reece Dunham Date: Wed, 8 Apr 2020 08:09:08 -0400 Subject: [PATCH 1/3] fix(v2): properly link top-level github pages sites in deploy command --- packages/docusaurus/src/commands/deploy.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/docusaurus/src/commands/deploy.ts b/packages/docusaurus/src/commands/deploy.ts index eab202407b70..b7369e09e3e8 100644 --- a/packages/docusaurus/src/commands/deploy.ts +++ b/packages/docusaurus/src/commands/deploy.ts @@ -167,12 +167,19 @@ export async function deploy( throw new Error('Error: Git push failed'); } else if (commitResults.code === 0) { // The commit might return a non-zero value when site is up to date. - const websiteURL = - githubHost === 'github.com' - ? // gh-pages hosted repo - `https://${organizationName}.github.io/${projectName}` - : // GitHub enterprise hosting. - `https://${githubHost}/pages/${organizationName}/${projectName}`; + let websiteURL = ''; + if (githubHost === 'github.com') { + // github.io hosting + if (projectName.includes('.github.io')) { + // domain root gh-pages hosted repo + websiteURL = `https://${organizationName}.github.io/`; + } else { + websiteURL = `https://${organizationName}.github.io/${projectName}/`; + } + } else { + // GitHub enterprise hosting. + websiteURL = `https://${githubHost}/pages/${organizationName}/${projectName}/`; + } shell.echo(`Website is live at ${websiteURL}`); shell.exit(0); } From 5d18e72348cf8f81784c7860e3bae27014c225ea Mon Sep 17 00:00:00 2001 From: Reece Dunham Date: Sat, 11 Apr 2020 20:56:06 -0400 Subject: [PATCH 2/3] Apply style --- packages/docusaurus/src/commands/deploy.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/docusaurus/src/commands/deploy.ts b/packages/docusaurus/src/commands/deploy.ts index b7369e09e3e8..352765a4b924 100644 --- a/packages/docusaurus/src/commands/deploy.ts +++ b/packages/docusaurus/src/commands/deploy.ts @@ -169,13 +169,11 @@ export async function deploy( // The commit might return a non-zero value when site is up to date. let websiteURL = ''; if (githubHost === 'github.com') { - // github.io hosting - if (projectName.includes('.github.io')) { - // domain root gh-pages hosted repo - websiteURL = `https://${organizationName}.github.io/`; - } else { - websiteURL = `https://${organizationName}.github.io/${projectName}/`; - } + websiteURL = projectName.includes('.github.io') + ? + `https://${organizationName}.github.io/`; + : + `https://${organizationName}.github.io/${projectName}/`; } else { // GitHub enterprise hosting. websiteURL = `https://${githubHost}/pages/${organizationName}/${projectName}/`; From 8553aaacecc8bb98ad916a5678f0c66e9323297a Mon Sep 17 00:00:00 2001 From: Reece Dunham Date: Sun, 12 Apr 2020 01:53:31 +0000 Subject: [PATCH 3/3] prettier format --- packages/docusaurus/src/commands/deploy.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/docusaurus/src/commands/deploy.ts b/packages/docusaurus/src/commands/deploy.ts index 352765a4b924..87db8f33ac5b 100644 --- a/packages/docusaurus/src/commands/deploy.ts +++ b/packages/docusaurus/src/commands/deploy.ts @@ -170,10 +170,8 @@ export async function deploy( let websiteURL = ''; if (githubHost === 'github.com') { websiteURL = projectName.includes('.github.io') - ? - `https://${organizationName}.github.io/`; - : - `https://${organizationName}.github.io/${projectName}/`; + ? `https://${organizationName}.github.io/` + : `https://${organizationName}.github.io/${projectName}/`; } else { // GitHub enterprise hosting. websiteURL = `https://${githubHost}/pages/${organizationName}/${projectName}/`;