import fs from 'fs' ; import { showError } from './logger.util' ; export const checkExistence = ( path ) : boolean => { return fs . existsSync ( process . cwd ( ) + path ) ; } ; export const checkIfDirExistElseMakeDir = ( hasPath , path ) : void => { if ( hasPath ) { let dir = checkExistence ( path ) ; if ( ! dir ) { fs . mkdirSync ( process . cwd ( ) + path , { recursive : true } ) ; } } } ; export const fileAlreadyExist = ( fileName ) : void => { showError ( `${ fileName } already exists!` ) ; process . exit ( 1 ) ; } ;