From 2f5d9a465f61fe0771bef2260b8cf0267c7491a8 Mon Sep 17 00:00:00 2001 From: Tom H Date: Tue, 9 Jul 2024 16:57:12 +0100 Subject: [PATCH] Updated exit codes --- src/helpers/checkIfInstalled.ts | 4 ++-- src/helpers/isFolderEmpty.ts | 2 +- src/helpers/isWriteable.ts | 2 +- src/inputs/getProjectPath.ts | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/helpers/checkIfInstalled.ts b/src/helpers/checkIfInstalled.ts index dd778d0..049cd0c 100644 --- a/src/helpers/checkIfInstalled.ts +++ b/src/helpers/checkIfInstalled.ts @@ -19,7 +19,7 @@ export function checkIfInstalled(library: Libraries) { stdio: 'ignore', }); - child.on('close', (code) => { + child.on('close', code => { if (code !== 0) { console.log( pc.red( @@ -79,5 +79,5 @@ function handleSpecificLibraryError({ break; } - return exit(1); + return exit(0); } diff --git a/src/helpers/isFolderEmpty.ts b/src/helpers/isFolderEmpty.ts index edea631..1f229fe 100644 --- a/src/helpers/isFolderEmpty.ts +++ b/src/helpers/isFolderEmpty.ts @@ -12,6 +12,6 @@ export async function isFolderEmpty({ root }: IsFolderEmptyProps) { if (files.length > 0) { console.error(`${pc.red(pc.bold('\nRoot folder must be empty'))}`); - exit(1); + exit(0); } } diff --git a/src/helpers/isWriteable.ts b/src/helpers/isWriteable.ts index 777fcc0..7998895 100644 --- a/src/helpers/isWriteable.ts +++ b/src/helpers/isWriteable.ts @@ -15,6 +15,6 @@ export async function isWriteable({ root }: IsWriteableProps) { console.error( `${pc.red(pc.bold('\nYou dont have permission to write to this folder'))}` ); - exit(1); + exit(0); } } diff --git a/src/inputs/getProjectPath.ts b/src/inputs/getProjectPath.ts index 71545d6..6ac02b5 100644 --- a/src/inputs/getProjectPath.ts +++ b/src/inputs/getProjectPath.ts @@ -16,11 +16,11 @@ export async function getProjectPath(projectName: string): Promise { )} because of npm naming restrictions:` ); - validation.errors.forEach((p) => + validation.errors.forEach(p => console.error(`${pc.red(pc.bold('*'))} ${p}`) ); - exit(1); + exit(0); } const resolvedProjectPath = path.resolve(projectName); @@ -31,7 +31,7 @@ export async function getProjectPath(projectName: string): Promise { if (folderExists) { console.error(`${pc.red(pc.bold('\nFolder already exists'))}`); - exit(1); + exit(0); } //! ADD THIS BACK WHEN NOT LOCALLY TESTING