import { resolve } from 'path'
import { config } from '@skava/di'
import { exists as doesFileExist } from 'flipfile'
export function resolveToRoot(relativePath: string) {
const appRootDir = config.get('appRootDir')
return resolve(appRootDir, relativePath)
}
// export function resolveToMono(relativePath: string) {}
export function oneUp(appRootDir: string): string {
const appRootDirList = appRootDir.split('/')
appRootDirList.pop()
const appRootOneUp = appRootDirList.join('/')
return appRootOneUp
}
export function exists(path: string) {
return (
doesFileExist(path) ||
doesFileExist(path + '.tsx') ||
doesFileExist(path + '.js')
)
}