import path from "path" ; import fs from "../../utils/fs" ; param { Output } return { string } function getCoverPath ( output ) { const outputRoot = output . getRoot ( ) ; const book = output . getBook ( ) ; const config = book . getConfig ( ) ; const coverName = config . getValue ( "cover" , "cover.jpg" ) ; let cover = fs . pickFile ( outputRoot , coverName ) ; if ( cover ) { return cover ; } if ( book . isLanguageBook ( ) ) { cover = fs . pickFile ( path . join ( outputRoot , ".." ) , coverName ) ; } return cover ; } export default getCoverPath ;