From f4effe49fc5328169dd5a0aaae437a3007e349b9 Mon Sep 17 00:00:00 2001 From: James George Date: Sun, 30 Jun 2019 11:08:39 +0530 Subject: [PATCH] chore: minor refactor (#1630) * feat: minor refactor * Minor fix * Update init.ts --- packages/docusaurus/src/commands/init.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/docusaurus/src/commands/init.ts b/packages/docusaurus/src/commands/init.ts index 8bf26eec89..5375923e6d 100644 --- a/packages/docusaurus/src/commands/init.ts +++ b/packages/docusaurus/src/commands/init.ts @@ -23,7 +23,7 @@ function hasYarn(): boolean { } function isValidGitRepoUrl(gitRepoUrl): boolean { - return gitRepoUrl.startsWith('https://') || gitRepoUrl.startsWith('git@'); + return ['https://', 'git@'].some(item => gitRepoUrl.startsWith(item)); } async function updatePkg(pkgPath: string, obj): Promise { @@ -162,12 +162,10 @@ export async function init( console.log(); // Display the most elegant way to cd. - let cdpath; - if (path.join(process.cwd(), name) === dest) { - cdpath = name; - } else { - cdpath = path.relative(process.cwd(), dest); - } + const cdpath = + path.join(process.cwd(), name) === dest + ? name + : path.relative(process.cwd(), name); console.log(); console.log(`Success! Created ${chalk.cyan(cdpath)}`);