From c6e76119000711436b0b2f48f8adf06e5dda723a Mon Sep 17 00:00:00 2001 From: samir paudyal <75193555+samir-byte@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:54:49 +0545 Subject: [PATCH] refactor(actions): conditional assignments --- src/cli/actions/initAction.ts | 4 +--- src/cli/actions/remoteAction.ts | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/cli/actions/initAction.ts b/src/cli/actions/initAction.ts index 989e8c8..5e533ad 100644 --- a/src/cli/actions/initAction.ts +++ b/src/cli/actions/initAction.ts @@ -37,9 +37,7 @@ export const runInitAction = async (rootDir: string, isGlobal: boolean): Promise export async function createConfigFile(rootDir: string, isGlobal: boolean): Promise { const isCancelled = false; - const configPath = isGlobal - ? path.resolve(getGlobalDirectory(), 'repopack.config.json') - : path.resolve(rootDir, 'repopack.config.json'); + const configPath = path.resolve(isGlobal ? getGlobalDirectory() : rootDir, 'repopack.config.json'); const isCreateConfig = await prompts.confirm({ message: `Do you want to create a ${isGlobal ? 'global ' : ''}${pc.green('repopack.config.json')} file?`, diff --git a/src/cli/actions/remoteAction.ts b/src/cli/actions/remoteAction.ts index 2f39a23..de59cab 100644 --- a/src/cli/actions/remoteAction.ts +++ b/src/cli/actions/remoteAction.ts @@ -77,10 +77,7 @@ const cleanupTempDirectory = async (directory: string): Promise => { const checkGitInstallation = async (): Promise => { try { const result = await execAsync('git --version'); - if (result.stderr) { - return false; - } - return true; + return !!result.stderr; } catch (error) { logger.debug('Git is not installed:', (error as Error).message); return false;